Package org.geoforge.guillcogc.panel

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

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

import gov.nasa.worldwind.layers.RenderableLayer;
import java.awt.event.ActionEvent;
import java.util.logging.Logger;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.TreeNode;
import org.geoforge.guillc.optionpane.GfrOptionPaneAbs;
import org.geoforge.guillc.treenode.GfrNodCtrAbs;
import org.geoforge.guillc.handler.IGfrHandlerToggableNode;
import org.geoforge.guillc.menuitem.GfrMimTrsAlrCheckAllAbs;
import org.geoforge.guillcogc.treenode.GfrNodCtrFixFolderRootChkSecOgc;
import org.geoforge.guillc.panel.GfrPnlCntWinViewerAppSerTabsOneChkWwdEarthAbs;
import org.geoforge.guillcogc.enumeration.GfrEnuValuesKindObjectTloSpcPrjOgc;
import org.geoforge.guillcogc.handler.IGfrHandlerControlUpdateButtonsCheckTlosPrjOgc;
import org.geoforge.lang.enumeration.GfrEnuApplicationPropertiesImmutableKeys;
import org.geoforge.java.util.logging.filehandler.FileHandlerLogger;

/**
*
* @author bantchao
*/
abstract public class GfrPnlCntWinViewerAppSerTabsOneChkWwdEarthOgcAbs extends GfrPnlCntWinViewerAppSerTabsOneChkWwdEarthAbs
{
   // ----
   // begin: instantiate logger for this class

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

   static
   {
      GfrPnlCntWinViewerAppSerTabsOneChkWwdEarthOgcAbs._LOGGER_.addHandler(FileHandlerLogger.s_getInstance());
   }

   // end: instantiate logger for this class
   // ----
  
   protected GfrPnlCntWinViewerAppSerTabsOneChkWwdEarthOgcAbs(
           String strNameSuffixThreadOpenDisplay,
           String strWhatViewer)
   {
      super(strNameSuffixThreadOpenDisplay, strWhatViewer);
   }
  
   public void removeVolatileLayer(RenderableLayer rlrVol)
    {
        if (super._pnlDisplays != null)
        {
           ((GfrPnlPrintableSctAwtDspPrjWwdEarthRunSecIfrOgcAbs) super._pnlDisplays).removeVolatileLayer(rlrVol);
        }
    }
   
   
    public void addVolatileLayer(RenderableLayer rlrVol)
    {
        if (super._pnlDisplays != null)
           ((GfrPnlPrintableSctAwtDspPrjWwdEarthRunSecIfrOgcAbs) super._pnlDisplays).addVolatileLayer(rlrVol);
       
        else
            GfrPnlCntWinViewerAppSerTabsOneChkWwdEarthOgcAbs._LOGGER_.info("super._pnlDisplays == null");
    }

   protected void _invokedLaterUpdateCheckUncheckTloOgc(IGfrHandlerToggableNode nodCheck)
   {
      GfrNodCtrAbs nod = (GfrNodCtrAbs) nodCheck;

      // updating buttons in control toolbar
      ((IGfrHandlerControlUpdateButtonsCheckTlosPrjOgc) super._pnlControls).updateButtonsCheckUncheckAllTlosProjectOgc(
              (GfrNodCtrAbs) nod.getRoot());
   }

   protected void _invokedLaterUpdateCheckUncheckTloOgc()
   {
      boolean blnAllowedAllCheck = ((IGfrHandlerControlUpdateButtonsCheckTlosPrjOgc) super._pnlControls).isAllowedEnableButtonCheckAllTlosProjectOgc();
      boolean blnAllowedAllUncheck = ((IGfrHandlerControlUpdateButtonsCheckTlosPrjOgc) super._pnlControls).isAllowedEnableButtonUncheckAllTlosProjectOgc();

      ((IGfrHandlerControlUpdateButtonsCheckTlosPrjOgc) super._pnlControls).updateButtonsCheckUncheckAllTlosProjectOgc(blnAllowedAllCheck, blnAllowedAllUncheck);
   }

   @Override
   public void actionPerformed(ActionEvent evt)
   {
      try
      {
         if (evt.getSource() instanceof GfrMimTrsAlrCheckAllAbs)
         {
            GfrMimTrsAlrCheckAllAbs mim = (GfrMimTrsAlrCheckAllAbs) evt.getSource();

            String strValueObjectKind = mim.getPropertyImmutable(
                    GfrEnuApplicationPropertiesImmutableKeys.KEY_KIND_OBJECT.name());

            //--!!!!!
            if (strValueObjectKind == null || strValueObjectKind.length() < 1)
               return;

            //--

            //-- checking object kind, no matters if CheckAllYes or CheckAllNo
            if (strValueObjectKind.compareTo(
                    GfrEnuValuesKindObjectTloSpcPrjOgc.VALUE_TLO_WMS.name()) == 0)
            {
               javax.swing.SwingUtilities.invokeLater(new Runnable()
               {

                  @Override
                  public void run()
                  {
                     _invokedLaterUpdateCheckUncheckTloOgc();
                  }
               });

               return;
            }
         }
      }
      catch (Exception exc)
      {
         exc.printStackTrace();
         GfrPnlCntWinViewerAppSerTabsOneChkWwdEarthOgcAbs._LOGGER_.warning(exc.getMessage());
         GfrOptionPaneAbs.s_showDialogError(null, exc.getMessage());
         return;
      }


      // bug
      String str = "uncaught source,  e.getSource().getClass().toString()="
              + evt.getSource().getClass().toString();

      GfrPnlCntWinViewerAppSerTabsOneChkWwdEarthOgcAbs._LOGGER_.severe(str);
      GfrOptionPaneAbs.s_showDialogError(null, str);
   }

   @Override
   protected void _invokedLaterUpdateCheckUncheckTlo(IGfrHandlerToggableNode nodCheck)
   {
      TreeNode nodRoot = ((DefaultMutableTreeNode) nodCheck).getRoot();

      if (nodRoot instanceof GfrNodCtrFixFolderRootChkSecOgc)
      {
         this._invokedLaterUpdateCheckUncheckTloOgc(nodCheck);

         return;
      }

      String strError = "Uncaught instanceof nodRoot: " + nodRoot.getClass().toString();
      GfrPnlCntWinViewerAppSerTabsOneChkWwdEarthOgcAbs._LOGGER_.severe(strError);
      GfrOptionPaneAbs.s_showDialogError(null, strError);
   }
}
TOP

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

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.