Package org.geoforge.guillc.panel

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

/*
*  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.ActionEvent;
import java.awt.event.ActionListener;
import java.util.logging.Logger;
import javax.help.HelpBroker;
import javax.swing.JPanel;
import org.geoforge.guihlp.handler.IGfrHandlerSetEnabledTrueHelpOnThisSection;
import org.geoforge.guillc.border.GfrBorderHelpOnThis;
import org.geoforge.guillc.handler.IGfrHandlerCloseSpace;
import org.geoforge.guillc.handler.IGfrHandlerOpenSpaceAny;
import org.geoforge.guillc.scrollpane.ScrAbs;
import org.geoforge.guillc.toolbar.GfrTbrHlpSubAbs;
import org.geoforge.java.util.logging.filehandler.FileHandlerLogger;

/**
*
* @author bantchao
*
* email: bantchao_AT_gmail.com
* ... please remove "_AT_" from the above string to get the right email address
*
*/
abstract public class GfrPnlPrintableSctAwtCtrAbs extends GfrPnlPrintableSctAwt implements
        IGfrHandlerSetEnabledTrueHelpOnThisSection,
        IGfrHandlerCloseSpace,
        IGfrHandlerOpenSpaceAny
{

   final static protected String _STR_WHAT = "Control";
  
   // ----
   // begin: instantiate logger for this class
   final private static Logger _LOGGER_ = Logger.getLogger(GfrPnlPrintableSctAwtCtrAbs.class.getName());

   static
   {
      GfrPnlPrintableSctAwtCtrAbs._LOGGER_.addHandler(FileHandlerLogger.s_getInstance());
   }
   // end: instantiate logger for this class
   // ----
  
   protected ScrAbs _scr = null;
   protected GfrTbrHlpSubAbs _tbr = null;
  
   private String _strOrientationToolbar_ = null;

   protected GfrPnlPrintableSctAwtCtrAbs(String strOrientationToolbar)
   {
      super();
     
      this._strOrientationToolbar_ = strOrientationToolbar;

      GfrBorderHelpOnThis.s_set((JPanel) this);
      super.setLayout(new BorderLayout());
   }
  
   @Override
    public void openSpaceAny(ActionListener alrControllerSpc) throws Exception
    {
       // !!!!!!! what about _scr? ok, handled by specialized space's handler
        ((IGfrHandlerOpenSpaceAny) this._tbr).openSpaceAny(alrControllerSpc);
    }
  
   @Override
    public void closeSpace() throws Exception
    {
        ((IGfrHandlerCloseSpace) this._scr).closeSpace();
        ((IGfrHandlerCloseSpace) this._tbr).closeSpace();
    }

   @Override
   public boolean init()
   {
      if (!super.init())
         return false;

      if (!this._tbr.init())
         return false;

      if (!this._scr.init())
         return false;

      this.add(this._tbr, this._strOrientationToolbar_); // toolbar's orientation
      this.add(this._scr, BorderLayout.CENTER);

      return true;
   }

   @Override
   public void destroy()
   {
      if (this._tbr != null)
      {
         this.remove(this._tbr);
         this._tbr.destroy();
         this._tbr = null;
      }

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

      super.destroy();
   }

   @Override
   public void setEnabledTrueHelpOnThisSection(HelpBroker hbr)
   {
      for (int i = 0; i < super.getComponentCount(); i++)
      {
         Component cmpCur = super.getComponent(i);

         if (cmpCur instanceof IGfrHandlerSetEnabledTrueHelpOnThisSection)
         {
            IGfrHandlerSetEnabledTrueHelpOnThisSection hot = (IGfrHandlerSetEnabledTrueHelpOnThisSection) cmpCur;
            hot.setEnabledTrueHelpOnThisSection(hbr);
         }
      }
   }

   @Override
   public void loadTransient() throws Exception
   {
   }

   @Override
   public void releaseTransient() throws Exception
   {
   }

   @Override
   public void actionPerformed(ActionEvent e)
   {
      super.actionPerformed(e);
   }
}
TOP

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

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.