Package org.geoforge.guillc.panel

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

/*
*  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 org.geoforge.guillc.jdesktop.jxlayer.plaf.MagnifierUI;
import org.geoforge.guillc.radiobutton.RbnIcnEffectsDistanceFeetAbs;
import org.geoforge.guillc.radiobutton.RbnIcnEffectsDistanceMetersAbs;
import org.geoforge.guillc.togglebutton.GfrTbnAbs;
import org.geoforge.guillc.togglebutton.GfrTbnShowHideCrossLinesOnMouseOver2d;
import org.geoforge.guillc.togglebutton.GfrTbnMagnifierJfcChart;
import org.geoforge.guillc.toolbar.GfrTbrHlpSubDspRunSecPrnTloJfcChartAbs;
import org.geoforge.jfreechart.chartpanel.GfrChartPanelDstAbs;
import org.jdesktop.jxlayer.JXLayer;
import org.jfree.chart.ChartMouseEvent;
import org.jfree.chart.ChartMouseListener;
import org.jfree.chart.ChartPanel;

/**
*
* @author robert
*/
abstract public class GfrPnlPrintableSctAwtDspSecTloJfcChartAbs extends GfrPnlPrintableSctAwtDspSecTloAbs implements
        ChartMouseListener
{
    protected GfrTbrHlpSubDspRunSecPrnTloJfcChartAbs _tbr = null;
    protected JXLayer _lyrMagnifier = null;
    protected MagnifierUI _magUi = null;
   
    private String _strLocationToolbar_ = null;
   
   
    abstract public String getUniqueNameTlo() throws Exception;
   


   protected GfrPnlPrintableSctAwtDspSecTloJfcChartAbs(
           GfrPnlStatusBarAbs pnlStatusBar,
           String strIdTlo,
           String strIdViewer,
           String strLocationToolbar)
   {
      super(pnlStatusBar, strIdTlo, strIdViewer);

      this._strLocationToolbar_ = strLocationToolbar;
   }
  
  

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

      if (!this._tbr.init())
         return false;
     
     
      super.add(this._tbr, this._strLocationToolbar_);

      return true;
   }

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

      this._lyrMagnifier = null;
      this._magUi = null;

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


   @Override
   public void chartMouseClicked(ChartMouseEvent evt)
   {
   }


   @Override
   public void actionPerformed(ActionEvent e)
   {
      Object objSource = e.getSource();
     
       if (objSource instanceof RbnIcnEffectsDistanceMetersAbs)
        {
            ((GfrChartPanelDstAbs) super._tot).setUnitDepthMeter(true);
            return;
        }
       
        if (objSource instanceof RbnIcnEffectsDistanceFeetAbs
        {
            ((GfrChartPanelDstAbs) super._tot).setUnitDepthMeter(false);
            return;
        }
       

      if (objSource instanceof GfrTbnShowHideCrossLinesOnMouseOver2d)
      {
         GfrTbnAbs tbn = (GfrTbnAbs) objSource;
         boolean bln = tbn.isSelected();
         ((ChartPanel) super._tot).setHorizontalAxisTrace(bln);
         ((ChartPanel) super._tot).setVerticalAxisTrace(bln);

         super.revalidate();

         if (super.isVisible())
            super.repaint();

         return;
      }

      if (objSource instanceof GfrTbnMagnifierJfcChart)
      {
         GfrTbnAbs tbn = (GfrTbnAbs) objSource;

         if (tbn.isSelected())
         {
            super.remove(((Component) super._tot));

            this._lyrMagnifier = new JXLayer(((Component) super._tot));
            this._magUi = new MagnifierUI();
            this._lyrMagnifier.setUI(this._magUi);
            super.add(_lyrMagnifier, BorderLayout.CENTER);
         }
         else
         {
            super.remove(this._lyrMagnifier);
            this._lyrMagnifier = null;
            this._magUi = null;

            super.add(((Component) super._tot), BorderLayout.CENTER);
         }

         super.revalidate();

         if (super.isVisible())
            super.repaint();

         return;
      }

      super.actionPerformed(e);
   }
}
TOP

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

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.