Package org.geoforge.guillc.tabbedpane

Source Code of org.geoforge.guillc.tabbedpane.GfrTabSpcAppClsPrjRunAbs

/*
*  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 2
*  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, write to the Free Software
*  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
*/

package org.geoforge.guillc.tabbedpane;





import java.awt.Component;
import java.awt.event.ActionListener;
import java.util.logging.Logger;
import javax.swing.plaf.basic.BasicTabbedPaneUI;
import org.geoforge.guillc.optionpane.GfrOptionPaneAbs;
import org.geoforge.guillc.panel.GfrPnlCadSpcPrjPrcRunAbs;
import org.geoforge.guillc.panel.GfrPnlSpcClsPrjRunAbs;
import org.geoforge.awt.image.GfrFactoryIconAbs;
import org.geoforge.io.awt.image.GfrFactoryIconAppGfr;
import org.geoforge.java.util.logging.filehandler.FileHandlerLogger;
import org.geoforge.wrpbasprsdsp.selection.lastspace.GfrWrpDspLastSpaceProject;


/**
*
* @author bantchao
*
* email: bantchao_AT_gmail.com
* ... please remove "_AT_" from the above string to get the right email address
*
*/
abstract public class GfrTabSpcAppClsPrjRunAbs extends GfrTabSpcAppClsPrjAbs
{
   // ----
    // begin: instantiate logger for this class
    final private static Logger _LOGGER_ = Logger.getLogger(GfrTabSpcAppClsPrjRunAbs.class.getName());

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

    // end: instantiate logger for this class
    // ----
  
    protected GfrPnlSpcClsPrjRunAbs _pnlDesktopViewers = null;
    protected GfrPnlSpcClsPrjRunAbs _pnlSynchroViewers = null;
   
    private boolean _blnShowTabsHeader_ = true;
   
    protected GfrTabSpcAppClsPrjRunAbs() throws Exception
    {
        super(
                "Process", // strTextTitleThisTab
                GfrFactoryIconAppGfr.s_getEarth(GfrFactoryIconAbs.INT_SIZE_XXSMALL), // TEMPO ICON icnTitleThisTab
                "Processing with all available business objects" // strTipTitleThisTab
                );
       
        super.setUI(new BasicTabbedPaneUI()
        { 
            @Override 
            protected int calculateTabAreaHeight(int tabPlacement, int horizRunCount, int maxTabHeight)
            { 
                if (GfrTabSpcAppClsPrjRunAbs.this._blnShowTabsHeader_)
                { 
                    return super.calculateTabAreaHeight(tabPlacement, horizRunCount, maxTabHeight)
                }
                else
               
                    return 0
               
            } 
        });
    }
   
   @Override
    public void closeSpace() throws Exception
    {
       this._blnShowTabsHeader_ = true;
       super.closeSpace();
    }

    public void setVisibleDisplayOnly(boolean bln)
   {     
      this._blnShowTabsHeader_ = !bln;
  
      if (bln)
      {
         Component cmpSelected = super.getSelectedComponent();
        
         if (cmpSelected != super._pnlThis)
            super.setSelectedComponent(super._pnlThis);
      }
     
      ((GfrPnlCadSpcPrjPrcRunAbs) super._pnlThis).setVisibleDisplayOnly(bln);
   }
   
    @Override
    protected void _updateStateChanged(int intIndex)
    {
       try
       {
           GfrWrpDspLastSpaceProject.getInstance().setLastTabRun(intIndex);
       }
      
       catch(Exception exc)
       {
          GfrTabSpcAppClsPrjRunAbs._LOGGER_.severe(exc.getMessage());
          GfrOptionPaneAbs.s_showDialogError(null, exc.getMessage());
       }
    }
   
    @Override
    public void openSpaceApplicationProject(ActionListener alrControllerSpcPrj, ActionListener alrControllerPrs) throws Exception
    {
        super.openSpaceApplicationProject(alrControllerSpcPrj, alrControllerPrs);
       
        int intSelected = 0;
        boolean blnHideAnything = false;

        try
        {
           blnHideAnything = GfrWrpDspLastSpaceProject.getInstance().getIsLastTabRunHideAnythingButProcessDesktop();
           this._blnShowTabsHeader_ = !blnHideAnything;
          
            intSelected = GfrWrpDspLastSpaceProject.getInstance().getLastTabRun();
        }
       
        catch(Exception exc)
        {
           exc.printStackTrace();
           GfrTabSpcAppClsPrjRunAbs._LOGGER_.severe(exc.getMessage());
           throw exc;
        }
       
        super.setSelectedIndex(intSelected);

        if (blnHideAnything)
        {
           Component cmpSelected = super.getSelectedComponent();
        
            if (cmpSelected != super._pnlThis)
               super.setSelectedComponent(super._pnlThis);
        }
    }

   
    @Override
    public boolean init()
    {
        if (! super.init()) // be carefull!
            return false;
       
        if (! this._pnlDesktopViewers.init())
            return false;
       
        if (! this._pnlSynchroViewers.init())
            return false;
       
       
        return true;
    }
   
    @Override
    public void destroy()
    {
        super.destroy();

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

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

Related Classes of org.geoforge.guillc.tabbedpane.GfrTabSpcAppClsPrjRunAbs

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.