Package org.geoforge.guillc.toolbar

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

/*
*  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.Dimension;
import java.awt.event.ActionListener;
import java.awt.event.MouseListener;
import javax.swing.JSeparator;
import javax.swing.SwingConstants;
import org.geoforge.guillc.button.BTransIcnCloseThisSpaceProject;
import org.geoforge.guillc.button.BtnTransActAbs;
import org.geoforge.guillc.button.BtnTransientToPopPrsAbs;
import org.geoforge.guillc.button.GfrBtnTransientDelAllTloAbs;
import org.geoforge.guillc.handler.IGfrHandlerCloseSpace;
import org.geoforge.guillc.handler.IGfrHandlerOpenSpaceAny;
import org.geoforge.lang.util.GfrResBundleLang;


/*
*  "Tbr" for "Toolbar"
*  "Spc" for "Space"
*  "Cls" for "Closable"
*  "Prj" for "Project"
*  "Abs" for "Abstract"
*/

/**
*
* @author bantchao
*
* email: bantchao_AT_gmail.com
* ... please remove "_AT_" from the above string to get the right email address
*
*/
abstract public class GfrTbrHlpMainSpcAppClsPrjAbs extends GfrTbrHlpMainSpcAppAbs implements
        IGfrHandlerOpenSpaceAny,
        IGfrHandlerCloseSpace
{
    protected BtnTransActAbs _btnClose = null;
   
    protected BtnTransientToPopPrsAbs _btnSwitchPerps = null;
   
    protected BtnTransientToPopPrsAbs _btnNewObject = null;
    protected GfrBtnTransientDelAllTloAbs _btnDeleteAll = null;
   
   
    protected GfrTbrHlpMainSpcAppClsPrjAbs(
            MouseListener mlrEffectsBorder,
            String strIdHelp) throws Exception
    {
        super(mlrEffectsBorder,
                GfrResBundleLang.s_getInstance().getValue("word.project").toLowerCase(), // strSuffixTitleDetached
                strIdHelp
                );
       
        this._btnClose = new BTransIcnCloseThisSpaceProject();

    }
   
   @Override
    public void openSpaceAny(ActionListener alrControllerSpcPrj)
            throws Exception
    {
        this._btnSwitchPerps.open(alrControllerSpcPrj);
        this._btnNewObject.open(alrControllerSpcPrj);
        this._btnDeleteAll.openSpaceAny(alrControllerSpcPrj);
    }

   
   @Override
    public void closeSpace()
            throws Exception
    {
        this._btnSwitchPerps.close();
        this._btnNewObject.close();
        this._btnDeleteAll.closeSpace();
    }

    @Override
    public boolean init()
    {
        if (! super.init())
            return false;
       
        if (! this._btnClose.init())
            return false;
       
        if (! this._btnSwitchPerps.init())
             return false;
       
        if (! this._btnNewObject.init())
             return false;
       
        if (! this._btnDeleteAll.init())
             return false;
       
       
        // ---
        int intPos = 0;
        JSeparator sep;
       
        super.add(this._btnClose, intPos++);
        // ---
        sep = new JSeparator(SwingConstants.VERTICAL);
        sep.setMaximumSize(new Dimension(super._intSizeIcons, super._intSizeIcons));
        sep.setMinimumSize(new Dimension(super._intSizeIcons, super._intSizeIcons));
        super.add(sep, intPos++);
       
       
        // ---
        super.add(this._btnSwitchPerps, intPos++);
        // ---
        sep = new JSeparator(SwingConstants.VERTICAL);
        sep.setMaximumSize(new Dimension(super._intSizeIcons, super._intSizeIcons));
        sep.setMinimumSize(new Dimension(super._intSizeIcons, super._intSizeIcons));
        super.add(sep, intPos++);
        // ---
       
        // ---
        if (super._btnPlugins != null)
        {
            intPos += 2;
        }

        // ---
        super.add(this._btnNewObject, intPos++);
        super.add(this._btnDeleteAll, intPos++);
      
        return true;
    }

    @Override
    public void destroy()
    {
        super.destroy();
       
        if (this._btnClose != null)
        {
            this._btnClose.destroy();
            this._btnClose = null;
        }
       
        if (this._btnSwitchPerps != null)
        {
            this._btnSwitchPerps.destroy();
            this._btnSwitchPerps = null;
        }
       
        if (this._btnNewObject != null)
        {
            this._btnNewObject.destroy();
            this._btnNewObject = null;
        }
       
         if (this._btnDeleteAll != null)
        {
            this._btnDeleteAll.destroy();
            this._btnDeleteAll = null;
        }
    }
   
   
    @Override
    public void loadTransient() throws Exception
    {
        super.loadTransient();
       
        this._btnSwitchPerps.loadTransient();
        this._btnNewObject.loadTransient();
        this._btnDeleteAll.loadTransient();
    }

    @Override
    public void releaseTransient() throws Exception
    {
        super.releaseTransient();
       
        this._btnSwitchPerps.releaseTransient();
        this._btnNewObject.releaseTransient();
        this._btnDeleteAll.releaseTransient();
    }
}
TOP

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

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.