/*
* 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.guillcogcecl.tree;
import java.awt.event.ActionListener;
import java.awt.event.MouseListener;
import javax.swing.event.TreeExpansionListener;
import javax.swing.event.TreeModelListener;
import javax.swing.event.TreeSelectionListener;
import javax.swing.tree.DefaultTreeModel;
import org.geoforge.guillc.panel.GfrPnlStatusBarSec;
import org.geoforge.guillc.tree.GfrTreCtrTopSpcTogChkPrjSecTlosAbs;
import org.geoforge.guillc.treenode.GfrNodCtrFixFolderRootAbs;
import org.geoforge.guillc.treenode.GfrNodCtrFixFolderTopPrjSecChkAbs;
import org.geoforge.guillcogcecl.treenode.*;
import org.geoforge.guillcogcecl.util.GfrResBundleGuiLlcOgcEcl;
/**
*
* @author bantchao
*
* email: bantchao_AT_gmail.com
* ... please remove "_AT_" from the above string to get the right email address
*
*/
abstract public class GfrTreCtrTopSpcTogChkPrjSecTlosEclWwdEarthAbs extends GfrTreCtrTopSpcTogChkPrjSecTlosAbs
{
transient protected GfrNodCtrFixFolderTopPrjSecChkAbs _nodSectors = null;
transient protected GfrNodCtrFixFolderTopPrjSecChkAbs _nodAreas = null;
transient protected GfrNodCtrFixFolderTopPrjSecChkAbs _nodPaths = null;
transient protected GfrNodCtrFixFolderTopPrjSecChkAbs _nodSegmentsWiseYes = null;
transient protected GfrNodCtrFixFolderTopPrjSecChkAbs _nodPlacemarks = null;
transient protected GfrNodCtrFixFolderTopPrjSecChkAbs _nodPoints = null;
transient protected GfrNodCtrFixFolderTopPrjSecChkAbs _nodPointsets = null;
protected GfrTreCtrTopSpcTogChkPrjSecTlosEclWwdEarthAbs(
MouseListener alrParentCad,
TreeSelectionListener lstTreeSelectionToolbar,
TreeExpansionListener lstTreeExpansionToolbar,
TreeModelListener lstTreeModelToolbar,
ActionListener alrParentPanelMvc,
GfrPnlStatusBarSec pnlStatusBar,
String strIdViewer)
{
super(
alrParentCad,
alrParentPanelMvc,
lstTreeSelectionToolbar,
lstTreeExpansionToolbar,
lstTreeModelToolbar,
new GfrNodCtrFixFolderRootChkSecEcl(GfrResBundleGuiLlcOgcEcl.s_getInstance().getValue("sentence.earthShapes")),
pnlStatusBar,
strIdViewer);
}
@Override
public void releaseTransient() throws Exception
{
super.releaseTransient();
if (this._nodSectors != null)
{
Object objRoot = super.getModel().getRoot();
GfrNodCtrFixFolderRootAbs nodRoot = (GfrNodCtrFixFolderRootAbs) objRoot;
nodRoot.remove(this._nodSectors);
// TODO: iterate through children, remove
this._nodSectors.releaseTransient();
this._nodSectors.destroy();
this._nodSectors = null;
}
if (this._nodAreas != null)
{
Object objRoot = super.getModel().getRoot();
GfrNodCtrFixFolderRootAbs nodRoot = (GfrNodCtrFixFolderRootAbs) objRoot;
nodRoot.remove(this._nodAreas);
// TODO: iterate through children, remove
this._nodAreas.releaseTransient();
this._nodAreas.destroy();
this._nodAreas = null;
}
if (this._nodPaths != null)
{
Object objRoot = super.getModel().getRoot();
GfrNodCtrFixFolderRootAbs nodRoot = (GfrNodCtrFixFolderRootAbs) objRoot;
nodRoot.remove(_nodPaths);
// TODO: iterate through children, remove
this._nodPaths.releaseTransient();
this._nodPaths.destroy();
this._nodPaths = null;
}
if (this._nodSegmentsWiseYes != null)
{
Object objRoot = super.getModel().getRoot();
GfrNodCtrFixFolderRootAbs nodRoot = (GfrNodCtrFixFolderRootAbs) objRoot;
nodRoot.remove(_nodSegmentsWiseYes);
// TODO: iterate through children, remove
this._nodSegmentsWiseYes.releaseTransient();
this._nodSegmentsWiseYes.destroy();
this._nodSegmentsWiseYes = null;
}
if (this._nodPoints != null)
{
Object objRoot = super.getModel().getRoot();
GfrNodCtrFixFolderRootAbs nodRoot = (GfrNodCtrFixFolderRootAbs) objRoot;
nodRoot.remove(_nodPoints);
// TODO: iterate through children, remove
this._nodPoints.releaseTransient();
this._nodPoints.destroy();
this._nodPoints = null;
}
if (this._nodPlacemarks != null)
{
Object objRoot = super.getModel().getRoot();
GfrNodCtrFixFolderRootAbs nodRoot = (GfrNodCtrFixFolderRootAbs) objRoot;
nodRoot.remove(_nodPlacemarks);
// TODO: iterate through children, remove
this._nodPlacemarks.releaseTransient();
this._nodPlacemarks.destroy();
this._nodPlacemarks = null;
}
if (this._nodPointsets != null)
{
Object objRoot = super.getModel().getRoot();
GfrNodCtrFixFolderRootAbs nodRoot = (GfrNodCtrFixFolderRootAbs) objRoot;
nodRoot.remove(_nodPointsets);
// TODO: iterate through children, remove
this._nodPointsets.releaseTransient();
this._nodPointsets.destroy();
this._nodPointsets = null;
}
}
@Override
public void destroy()
{
super.destroy();
// TODO: remove children from root
if (this._nodSectors != null)
{
// TODO: iterate through children, remove
this._nodSectors.destroy();
this._nodSectors = null;
}
if (this._nodAreas != null)
{
// TODO: iterate through children, remove
this._nodAreas.destroy();
this._nodAreas = null;
}
if (this._nodPaths != null)
{
// TODO: iterate through children, remove
this._nodPaths.destroy();
this._nodPaths = null;
}
if (this._nodSegmentsWiseYes != null)
{
// TODO: iterate through children, remove
this._nodSegmentsWiseYes.destroy();
this._nodSegmentsWiseYes = null;
}
if (this._nodPoints != null)
{
// TODO: iterate through children, remove
this._nodPoints.destroy();
this._nodPoints = null;
}
if (this._nodPlacemarks != null)
{
// TODO: iterate through children, remove
this._nodPlacemarks.destroy();
this._nodPlacemarks = null;
}
if (this._nodPointsets != null)
{
// TODO: iterate through children, remove
this._nodPointsets.destroy();
this._nodPointsets = null;
}
}
protected void _addChildren() throws Exception
{
Object objRoot = super.getModel().getRoot();
// beg this order
GfrNodCtrFixFolderRootAbs nodRoot = (GfrNodCtrFixFolderRootAbs) objRoot;
nodRoot.setTree(this);
DefaultTreeModel dtm = (DefaultTreeModel) super.getModel();
dtm.insertNodeInto(_nodPointsets, nodRoot, 0);
dtm.insertNodeInto(_nodPlacemarks, nodRoot, 0);
dtm.insertNodeInto(_nodPoints, nodRoot, 0);
dtm.insertNodeInto(_nodSegmentsWiseYes, nodRoot, 0);
dtm.insertNodeInto(_nodPaths, nodRoot, 0);
dtm.insertNodeInto(_nodAreas, nodRoot, 0);
dtm.insertNodeInto(_nodSectors, nodRoot, 0);
dtm.nodeStructureChanged(nodRoot);
if (!this._nodSectors.init())
throw new Exception("! this._nodSectors.init()");
if (!this._nodSegmentsWiseYes.init())
throw new Exception("! this._nodSegmentsWiseYes.init()");
if (!this._nodAreas.init())
throw new Exception("! this._nodAreas.init()");
if (!this._nodPaths.init())
throw new Exception("! this._nodPaths.init()");
if (!this._nodPoints.init())
throw new Exception("! this._nodPoints.init()");
if (!this._nodPlacemarks.init())
throw new Exception("! this._nodPlacemarks.init()");
if (!this._nodPointsets.init())
throw new Exception("! this._nodPointsets.init()");
if (super.isVisible())
super.expandAll();
super.setRootVisible(false);
// end this order
}
@Override
public void closeSpace() throws Exception
{
super.closeSpace();
if (this._nodSectors != null)
{
// TODO: iterate through children, remove
this._nodSectors.destroy();
this._nodSectors = null;
}
if (this._nodAreas != null)
{
// TODO: iterate through children, remove
this._nodAreas.destroy();
this._nodAreas = null;
}
if (this._nodPaths != null)
{
// TODO: iterate through children, remove
this._nodPaths.destroy();
this._nodPaths = null;
}
if (this._nodSegmentsWiseYes != null)
{
// TODO: iterate through children, remove
this._nodSegmentsWiseYes.destroy();
this._nodSegmentsWiseYes = null;
}
if (this._nodPoints != null)
{
// TODO: iterate through children, remove
this._nodPoints.destroy();
this._nodPoints = null;
}
if (this._nodPlacemarks != null)
{
// TODO: iterate through children, remove
this._nodPlacemarks.destroy();
this._nodPlacemarks = null;
}
if (this._nodPointsets != null)
{
// TODO: iterate through children, remove
this._nodPointsets.destroy();
this._nodPointsets = null;
}
}
@Override
public void folderAllCollapse()
{
if (!super._blnIsOpen)
return;
super.folderAllCollapse(this._nodSectors);
super.folderAllCollapse(this._nodAreas);
super.folderAllCollapse(this._nodPaths);
super.folderAllCollapse(this._nodSegmentsWiseYes);
super.folderAllCollapse(this._nodPoints);
super.folderAllCollapse(this._nodPlacemarks);
super.folderAllCollapse(this._nodPointsets);
}
@Override
public void folderAllExpand()
{
if (!super._blnIsOpen)
return;
super.folderAllExpand(this._nodSectors);
super.folderAllExpand(this._nodAreas);
super.folderAllExpand(this._nodPaths);
super.folderAllExpand(this._nodSegmentsWiseYes);
super.folderAllExpand(this._nodPoints);
super.folderAllExpand(this._nodPlacemarks);
super.folderAllExpand(this._nodPointsets);
}
@Override
public boolean isAllowedFolderAllCollapse() throws Exception
{
if (!super._blnIsOpen)
return false;
if (super.isAllowedFolderAllCollapse(this._nodSectors))
return true;
if (super.isAllowedFolderAllCollapse(this._nodAreas))
return true;
if (super.isAllowedFolderAllCollapse(this._nodSegmentsWiseYes))
return true;
if (super.isAllowedFolderAllCollapse(this._nodPaths))
return true;
if (super.isAllowedFolderAllCollapse(this._nodPoints))
return true;
if (super.isAllowedFolderAllCollapse(this._nodPlacemarks))
return true;
if (super.isAllowedFolderAllCollapse(this._nodPointsets))
return true;
return false;
}
@Override
public boolean isAllowedFolderAllExpand() throws Exception
{
if (!super._blnIsOpen)
return false;
if (super.isAllowedFolderAllExpand(this._nodSectors))
return true;
if (super.isAllowedFolderAllExpand(this._nodAreas))
return true;
if (super.isAllowedFolderAllExpand(this._nodSegmentsWiseYes))
return true;
if (super.isAllowedFolderAllExpand(this._nodPaths))
return true;
if (super.isAllowedFolderAllExpand(this._nodPoints))
return true;
if (super.isAllowedFolderAllExpand(this._nodPlacemarks))
return true;
if (super.isAllowedFolderAllExpand(this._nodPointsets))
return true;
return false;
}
@Override
public void childrenAllCheck()
{
if (!super._blnIsOpen)
return;
this._nodSectors.childrenAllCheck();
this._nodAreas.childrenAllCheck();
this._nodPaths.childrenAllCheck();
this._nodSegmentsWiseYes.childrenAllCheck();
this._nodPoints.childrenAllCheck();
this._nodPlacemarks.childrenAllCheck();
this._nodPointsets.childrenAllCheck();
}
@Override
public void childrenAllUncheck()
{
if (!super._blnIsOpen)
return;
this._nodSectors.childrenAllUncheck();
this._nodAreas.childrenAllUncheck();
this._nodPaths.childrenAllUncheck();
this._nodSegmentsWiseYes.childrenAllUncheck();
this._nodPoints.childrenAllUncheck();
this._nodPlacemarks.childrenAllUncheck();
this._nodPointsets.childrenAllUncheck();
}
}