Package org.geoforge.guillc.panel

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

/*
*  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.event.MouseEvent;
import java.util.logging.Logger;
import javax.help.HelpBroker;
import javax.swing.JSplitPane;
import javax.swing.JTree;
import javax.swing.SwingUtilities;
import org.geoforge.guihlp.handler.IGfrHandlerSetEnabledTrueHelpOnThisSection;
import org.geoforge.guillc.optionpane.GfrOptionPaneAbs;
import org.geoforge.guillc.treenode.GfrNodAbs;
import org.geoforge.guillc.handler.IGfrHandlerToggableNode;
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 GfrPnlCntWinViewerAppSerTabsOneChkAbs extends GfrPnlCntWinViewerAppSerTabsAbs
{
   // ----
    // begin: instantiate logger for this class
    final private static Logger _LOGGER_ = Logger.getLogger(GfrPnlCntWinViewerAppSerTabsOneChkAbs.class.getName());

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

    // end: instantiate logger for this class
    // ----
   

    protected GfrPnlPrintableSctAwtDspPrjAbs  _pnlDisplays = null;
   
    abstract protected void _invokedLaterUpdateCheckUncheckTlo(IGfrHandlerToggableNode nodCheck);
   

    protected GfrPnlCntWinViewerAppSerTabsOneChkAbs()
    {
        super(
                300 // intDividerLocation
                );
     
    }
   
    public void setVisibleDisplayOnly(boolean bln)
    {     
       this._pnlDisplays.setVisibleDisplayOnly(bln);
      
       if (bln)
       {
          super._spnHorizontal.setDividerLocation(0.0d);
          super._pnlContainerControl.setVisible(false);
          super._spnHorizontal.setDividerSize(0);
       }
      
       else
       {
          super._spnHorizontal.setDividerSize(10);
          super._spnHorizontal.setDividerLocation(300);
          super._pnlContainerControl.setVisible(true);
       }
    }
   
   
    @Override
    public void loadUnserializedObject() throws Exception
    {
        super.loadUnserializedObject();
  
         if (this._pnlDisplays != null)
            this._pnlDisplays.loadUnserializedObject();
      
    }
   
    @Override
    public void releaseUnserializedObject() throws Exception
    {
        super.releaseUnserializedObject();

         if (this._pnlDisplays != null)
               this._pnlDisplays.releaseUnserializedObject();
     
    }
   
    @Override
    public boolean init()
    {
        if (! super.init())
            return false;

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

        super._spnHorizontal.add(this._pnlContainerControl, JSplitPane.LEFT);

        return true;
    }

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

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

    }

    @Override
    public void setEnabledTrueHelpOnThisSection(HelpBroker hbr)
    {
       super.setEnabledTrueHelpOnThisSection(hbr);
              
        if (this._pnlDisplays != null)
            ((IGfrHandlerSetEnabledTrueHelpOnThisSection) this._pnlDisplays).setEnabledTrueHelpOnThisSection(hbr);
   
    }
   
    @Override
    public void mousePressed(MouseEvent evt)
    {
        if (! (evt.getSource() instanceof JTree))
        {
            String str = "! (e.getSource() instanceof JTree)";
            GfrPnlCntWinViewerAppSerTabsOneChkAbs._LOGGER_.severe(str);
            GfrOptionPaneAbs.s_showDialogError(null, str);
            return;
        }
       
        JTree tre = (JTree) evt.getSource();
 
        if (SwingUtilities.isRightMouseButton(evt) | SwingUtilities.isMiddleMouseButton(evt))
            return;

        int intX = evt.getX();
        int intY = evt.getY();

        int intRow = tre.getRowForLocation(intX, intY);
        javax.swing.tree.TreePath pth = tre.getPathForRow(intRow);


        if (pth == null)
            return;


        GfrNodAbs nod = (GfrNodAbs) pth.getLastPathComponent();

        if (! (nod instanceof IGfrHandlerToggableNode))
            return;
       

        final IGfrHandlerToggableNode nodCheck = (IGfrHandlerToggableNode) nod;

        javax.swing.SwingUtilities.invokeLater(new Runnable()
        {
            @Override
            public void run()
            {
                 _invokedLaterUpdateCheckUncheckTlo(nodCheck);
            }
        })
    }
}
TOP

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

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.