Package org.geoforge.guillc.panel

Source Code of org.geoforge.guillc.panel.GfrPnlCntWinViewerAppSerTabsOneChkWwdEarthAbs

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

import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.event.ActionListener;
import java.util.EventObject;
import java.util.logging.Logger;
import org.geoforge.guillc.handler.IGfrHandlerControlUpdateButtonsCheckTlosPrjThis;
import org.geoforge.guillc.handler.IGfrHandlerToggableNode;
import org.geoforge.guillc.treenode.GfrNodCtrAbs;
import org.geoforge.guillc.util.threadpoolexecutor.GfrWrkOpenDisplayWwdEarth;
import org.geoforge.java.enumeration.GfrEnuSystemPropertiesKeys;
import org.geoforge.java.util.logging.filehandler.FileHandlerLogger;
import org.geoforge.lang.util.threadpoolexecutor.GfrTpeSpcPrj;

/**
*
* @author bantchao
*/
abstract public class GfrPnlCntWinViewerAppSerTabsOneChkWwdEarthAbs extends GfrPnlCntWinViewerAppSerTabsOneChkAbs implements
        GfrWrkOpenDisplayWwdEarth.WrkOpenDisplayListener
{
   static private boolean _BLN_DEBUG_ = false;
  
   static
   {
      String str = System.getProperty(GfrEnuSystemPropertiesKeys.DEBUG_APPLI.getLabel());
     
      if (str!=null && str.compareTo("true") == 0)
         _BLN_DEBUG_ = true;
   }
  
  
   // beg tempo
    static private boolean _BLN_DEV_NO_DISPLAY_ = false;
   
    static
    {
       String str = System.getProperty(GfrEnuSystemPropertiesKeys.SHOULD_HIDE_DISPLAY_EARTH_WORLDWIND.getLabel());
      
       if (str != null && str.compareTo("true") == 0)
          _BLN_DEV_NO_DISPLAY_ = true;
         
    }
    // end tempo
  
  
   // ----
   // begin: instantiate logger for this class

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

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

   // end: instantiate logger for this class
   // ----
  
  
    private GfrPnlEarthLoadingAbs _pnlLoadingNot_ = null;
    private GfrPnlEarthLoadingAbs _pnlLoadingStarted_ = null;
    private GfrPnlEarthLoadingAbs _pnlLoadingFailed_ = null;
   
    private String _strNameSuffixThreadOpenDisplay_ = null;
   
    transient private GfrWrkOpenDisplayWwdEarth _wrkThreadPoolExecutor_ = null;
   
    public String getRestorableStateOrbitView()
    {
       if (super._pnlDisplays != null)
          return ((GfrPnlPrintableSctAwtDspPrjWwdEarthAbs) super._pnlDisplays).getRestorableStateOrbitView();
      
       return null;
    }
   
    public gov.nasa.worldwind.WorldWindow getCanvas()
    {
        if (super._pnlDisplays != null)
            return ((GfrPnlPrintableSctAwtDspPrjWwdEarthAbs) super._pnlDisplays).getCanvas();
       
        return null;
    }
  
   protected GfrPnlCntWinViewerAppSerTabsOneChkWwdEarthAbs(
           String strNameSuffixThreadOpenDisplay,
           String strWhatViewer)
   {
      super();
     
      this._strNameSuffixThreadOpenDisplay_ = strNameSuffixThreadOpenDisplay;
     
      this._pnlLoadingNot_ = new GfrPnlEarthLoadingNot(strWhatViewer);
      this._pnlLoadingStarted_ = new GfrPnlEarthLoadingStarted(strWhatViewer);
      this._pnlLoadingFailed_ = new GfrPnlEarthLoadingFailed(strWhatViewer);
   }
  
   @Override
    public boolean init()
    {
        if (! super.init())
            return false;
    
        // beg display
        super._pnlContainerDisplay.add((Component) this._pnlLoadingNot_, BorderLayout.CENTER);
        // end display
       
        return true;
    }
  
   @Override
    public void destroy()
    {
       if (this._wrkThreadPoolExecutor_ != null)
       {
          this._wrkThreadPoolExecutor_.removeEventListener(this);
          this._wrkThreadPoolExecutor_ = null;
       }
      
        super.destroy();
       
        if (this._pnlLoadingNot_ != null) // !!! NO INIT !!!
        {
            this._pnlLoadingNot_.destroy();
            this._pnlLoadingNot_ = null;
        }
       
        if (this._pnlLoadingStarted_ != null) // !!! NO INIT !!!
        {
            this._pnlLoadingStarted_.destroy();
            this._pnlLoadingStarted_ = null;
        }
       
        if (this._pnlLoadingFailed_ != null) // !!! NO INIT !!!
        {
            this._pnlLoadingFailed_.destroy();
            this._pnlLoadingFailed_ = null;
        }
    }
  
   @Override
    public void handleEventWrkOpenDisplay(EventObject evt)
    {
       try
       {
      
         GfrWrkOpenDisplayWwdEarth.EvtWrkOpenDisplay evtMy = (GfrWrkOpenDisplayWwdEarth.EvtWrkOpenDisplay) evt;
      
         GfrWrkOpenDisplayWwdEarth wrk = (GfrWrkOpenDisplayWwdEarth) evt.getSource();

         String strNameThread = wrk.toString();
         String strValueNew = evtMy.getResult();
        
         //if (_BLN_DEBUG_)
           // System.out.println("strNameThread=" + strNameThread + ", " + strValueNew); 
        
         if (strValueNew.compareTo(GfrWrkOpenDisplayWwdEarth.STR_STARTED) == 0)
         {
            //if (_BLN_DEBUG_)
              // System.out.println(">> info: " + strValueNew);
           
            return;
         }
        
         if (strValueNew.compareTo(GfrWrkOpenDisplayWwdEarth.STR_FAILED) == 0)
         {
            boolean blnDoValidate = false;
           
            if (super._pnlContainerDisplay.isAncestorOf(this._pnlLoadingNot_))
            {
               super._pnlContainerDisplay.remove(this._pnlLoadingNot_);
               blnDoValidate |= true;
            }
           
            if (super._pnlContainerDisplay.isAncestorOf(this._pnlLoadingStarted_))
            {
               super._pnlContainerDisplay.remove(this._pnlLoadingStarted_);
               blnDoValidate |= true;
            }
           
            if (super._pnlContainerDisplay.isAncestorOf(super._pnlDisplays))
            {
               super._pnlContainerDisplay.remove(super._pnlDisplays);
               blnDoValidate |= true;
            }
           
            if (! super._pnlContainerDisplay.isAncestorOf(this._pnlLoadingFailed_))
            {
               super._pnlContainerDisplay.add((Component) this._pnlLoadingFailed_, BorderLayout.CENTER);
               blnDoValidate |= true;
            }
           
            if (blnDoValidate && super._pnlContainerDisplay.isVisible())
               super._pnlContainerDisplay.validate();
           
            return;
         }
        
         if (strValueNew.compareTo(GfrWrkOpenDisplayWwdEarth.STR_DONE) == 0)
         {
            boolean blnDoValidate = false;
           
            if (super._pnlContainerDisplay.isAncestorOf(this._pnlLoadingNot_))
            {
               super._pnlContainerDisplay.remove(this._pnlLoadingNot_);
               blnDoValidate |= true;
            }
           
            if (super._pnlContainerDisplay.isAncestorOf(this._pnlLoadingStarted_))
            {
               super._pnlContainerDisplay.remove(this._pnlLoadingStarted_);
               blnDoValidate |= true;
            }
           
           
            if (super._pnlContainerDisplay.isAncestorOf(this._pnlLoadingFailed_))
            {
               super._pnlContainerDisplay.remove(this._pnlLoadingFailed_);
                blnDoValidate |= true;
            }
           
            if (! super._pnlContainerDisplay.isAncestorOf(super._pnlDisplays))
            {
               super._pnlContainerDisplay.add((Component) super._pnlDisplays, BorderLayout.CENTER);
                blnDoValidate |= true;
            }
           
            if (blnDoValidate && super._pnlContainerDisplay.isVisible())
               super._pnlContainerDisplay.validate();
           
            return;
         }
       
       }
      
       catch(Exception exc)
       {
          exc.printStackTrace();
          exc.printStackTrace();
          GfrPnlCntWinViewerAppSerTabsOneChkWwdEarthAbs._LOGGER_.info(exc.getMessage());
       }
    }
  
   @Override
    public void open(ActionListener alrControllerSpcPrj, ActionListener alrControllerPrs) throws Exception
    {
       super.open(alrControllerSpcPrj, alrControllerPrs);
      
       
       
        if (! _BLN_DEV_NO_DISPLAY_)
        {
           boolean blnDoValidate = false;
          
           if (super._pnlContainerDisplay.isAncestorOf(super._pnlDisplays))
           {
              super._pnlContainerDisplay.remove(super._pnlDisplays);
              blnDoValidate |= true;
           }
          
           if (super._pnlContainerDisplay.isAncestorOf(this._pnlLoadingFailed_))
           {
              super._pnlContainerDisplay.remove(this._pnlLoadingFailed_);
              blnDoValidate |= true;
           }
          
           if (super._pnlContainerDisplay.isAncestorOf(this._pnlLoadingNot_))
           {
              super._pnlContainerDisplay.remove(this._pnlLoadingNot_);
              blnDoValidate |= true;
           }
        
           if (! super._pnlContainerDisplay.isAncestorOf(this._pnlLoadingStarted_))
           {
              super._pnlContainerDisplay.add((Component) this._pnlLoadingStarted_, BorderLayout.CENTER);
              blnDoValidate |= true;
           }
          
           if (blnDoValidate && super._pnlContainerDisplay.isVisible())
               super._pnlContainerDisplay.validate();
      
           this._wrkThreadPoolExecutor_  = new GfrWrkOpenDisplayWwdEarth(
               alrControllerSpcPrj,
               alrControllerPrs,
               this._strNameSuffixThreadOpenDisplay_,
               super._pnlDisplays,
               (GfrWrkOpenDisplayWwdEarth.WrkOpenDisplayListener) this);
          
          
           GfrTpeSpcPrj.s_getInstance().execute(this._wrkThreadPoolExecutor_ );
        }
    }
  
  
  
   protected void _invokedLaterUpdateCheckUncheckTloThis()
    {
        boolean blnAllowedAllCheck = ((IGfrHandlerControlUpdateButtonsCheckTlosPrjThis) super._pnlControls).isAllowedEnableButtonCheckAllTlosProjectThis();
        boolean blnAllowedAllUncheck = ((IGfrHandlerControlUpdateButtonsCheckTlosPrjThis) super._pnlControls).isAllowedEnableButtonUncheckAllTlosProjectThis();

        ((IGfrHandlerControlUpdateButtonsCheckTlosPrjThis) super._pnlControls).updateButtonsCheckUncheckAllTlosProjectThis(blnAllowedAllCheck, blnAllowedAllUncheck);
    }
  
   protected void _invokedLaterUpdateCheckUncheckTloThis(IGfrHandlerToggableNode nodCheck)
   {
       GfrNodCtrAbs nod = (GfrNodCtrAbs) nodCheck;
      
        // updating buttons in control toolbar
        ((IGfrHandlerControlUpdateButtonsCheckTlosPrjThis) super._pnlControls).updateButtonsCheckUncheckAllTlosProjectThis(
                (GfrNodCtrAbs) nod.getRoot());    
   }
}
TOP

Related Classes of org.geoforge.guillc.panel.GfrPnlCntWinViewerAppSerTabsOneChkWwdEarthAbs

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.