Package org.geoforge.guillc.toolbar

Source Code of org.geoforge.guillc.toolbar.GfrTbrHlpSubDspRunSecPrnTloJfcChartAbs

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

import java.awt.event.ActionListener;
import java.awt.event.MouseListener;
import java.util.Enumeration;
import java.util.logging.Logger;
import javax.swing.AbstractButton;
import javax.swing.JRadioButton;
import org.geoforge.guillc.buttongroup.GfrBgp;
import org.geoforge.guillc.buttongroup.GfrBgpUnitDistanceXSmall;
import org.geoforge.guillc.buttongroup.GfrBgpUnitDistanceXXSmall;
import org.geoforge.guillc.togglebutton.GfrTbnAbs;
import org.geoforge.guillc.togglebutton.GfrTbnShowHideCrossLinesOnMouseOver2d;
import org.geoforge.guillc.togglebutton.GfrTbnMagnifierJfcChart;
import org.geoforge.awt.image.GfrFactoryIconAbs;
import org.geoforge.guillc.buttongroup.GfrBgpUnitDistanceSmall;
import org.geoforge.java.awt.container.GfrUtilContainer;
import org.geoforge.java.util.logging.filehandler.FileHandlerLogger;

/**
*
* @author robert
*/
abstract public class GfrTbrHlpSubDspRunSecPrnTloJfcChartAbs extends GfrTbrHlpSubDspRunSecPrnAbs
{
    final static private Logger _LOGGER_ = Logger.getLogger(GfrTbrHlpSubDspRunSecPrnTloJfcChartAbs.class.getName());

    static
    {
        GfrTbrHlpSubDspRunSecPrnTloJfcChartAbs._LOGGER_.addHandler(FileHandlerLogger.s_getInstance());
    }
   
   private GfrBgp _bgpUnitDistance_ = null;
   private GfrTbnAbs _tbnMagnifier_ = null;
  
   protected GfrTbnAbs _tbnCrossOnMouseOver = null; // used to append items

   protected GfrTbrHlpSubDspRunSecPrnTloJfcChartAbs(
           ActionListener alrParentComponent,
           MouseListener mlrEffectsBorder,
           int intLocationThis,
           int intSizeIcons) throws Exception
   {
      super(
              intLocationThis,
              intSizeIcons,
              mlrEffectsBorder,
              alrParentComponent);

      if (intSizeIcons == GfrFactoryIconAbs.INT_SIZE_XXSMALL)
         this._bgpUnitDistance_ =
              new GfrBgpUnitDistanceXXSmall("Depth", alrParentComponent);
      else if (intSizeIcons == GfrFactoryIconAbs.INT_SIZE_XSMALL)
         this._bgpUnitDistance_ =
              new GfrBgpUnitDistanceXSmall("Depth", alrParentComponent);
      else if (intSizeIcons == GfrFactoryIconAbs.INT_SIZE_SMALL)
         this._bgpUnitDistance_ =
              new GfrBgpUnitDistanceSmall("Depth", alrParentComponent);
      else
      {
          String strDevCodingError = "Dev coding error, uncaught icons size, intSizeIcons=" + intSizeIcons;
         GfrTbrHlpSubDspRunSecPrnTloJfcChartAbs._LOGGER_.severe(strDevCodingError);
         throw new Exception(strDevCodingError);
      }

      this._tbnMagnifier_ = new GfrTbnMagnifierJfcChart(intSizeIcons);
      this._tbnCrossOnMouseOver = new GfrTbnShowHideCrossLinesOnMouseOver2d(intSizeIcons);

      this._tbnMagnifier_.addActionListener(alrParentComponent);
      this._tbnCrossOnMouseOver.addActionListener(alrParentComponent);
   }

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

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

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

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


      int intPos = 0;
       
        if (super._btnPlugins != null)
        {
            intPos = GfrUtilContainer.s_getPosition(this, super._btnPlugins);
            intPos++;
            intPos++;
        }
       
 

      // ----

      intPos = this._add(this._bgpUnitDistance_.getElements(), intPos);

      //
      intPos++; // btnPrint ???????????????????

      super.add(this._tbnMagnifier_, intPos++);
      super.add(this._tbnCrossOnMouseOver, intPos++);

      return true;
   }

   @Override
   public void destroy()
   {
      super.destroy();

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

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

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

   private int _add(Enumeration<AbstractButton> enu, int intPos)
   {
      while (enu.hasMoreElements())
      {
         JRadioButton btn = (JRadioButton) enu.nextElement();
         super.add(btn, intPos++);
      }

      return intPos;
   }
}
TOP

Related Classes of org.geoforge.guillc.toolbar.GfrTbrHlpSubDspRunSecPrnTloJfcChartAbs

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.