/*
* 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 javax.swing.event.TreeExpansionListener;
import javax.swing.event.TreeModelListener;
import javax.swing.event.TreeSelectionListener;
import javax.swing.tree.DefaultTreeModel;
import org.geoforge.guillc.tree.GfrTreCtrTopSpcLblPrjAbs;
import org.geoforge.guillc.treenode.GfrNodCtrFixFolderRootAbs;
import org.geoforge.guillc.treenode.GfrNodCtrFixFolderTopAbs;
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 GfrTreCtrTopSpcLblPrjEclAbs extends GfrTreCtrTopSpcLblPrjAbs
{
protected GfrNodCtrFixFolderTopAbs _nodSectors = null;
protected GfrNodCtrFixFolderTopAbs _nodAreas = null;
protected GfrNodCtrFixFolderTopAbs _nodPaths = null;
protected GfrNodCtrFixFolderTopAbs _nodSegmentWiseYes = null;
protected GfrNodCtrFixFolderTopAbs _nodPlacemarks = null;
protected GfrNodCtrFixFolderTopAbs _nodPoints = null;
protected GfrNodCtrFixFolderTopAbs _nodPointsets = null;
protected GfrTreCtrTopSpcLblPrjEclAbs(
ActionListener alrParentPanelMvc,
TreeSelectionListener lstTreeSelectionToolbar,
TreeExpansionListener lstTreeExpansionToolbar,
TreeModelListener lstTreeModelToolbar)
{
super(GfrResBundleGuiLlcOgcEcl.s_getInstance().getValue("sentence.earthShapes"),
alrParentPanelMvc,
lstTreeSelectionToolbar,
lstTreeExpansionToolbar,
lstTreeModelToolbar
);
}
@Override
public void folderAllCollapse()
{
if (! super._blnIsOpen)
return;
super.folderAllCollapse(this._nodSectors);
super.folderAllCollapse(this._nodAreas);
super.folderAllCollapse(this._nodPaths);
super.folderAllCollapse(this._nodSegmentWiseYes);
super.folderAllCollapse(this._nodPlacemarks);
super.folderAllCollapse(this._nodPoints);
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._nodSegmentWiseYes);
super.folderAllExpand(this._nodPlacemarks);
super.folderAllExpand(this._nodPoints);
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._nodPaths))
return true;
if (super.isAllowedFolderAllCollapse(this._nodSegmentWiseYes))
return true;
if (super.isAllowedFolderAllCollapse(this._nodPlacemarks))
return true;
if (super.isAllowedFolderAllCollapse(this._nodPoints))
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._nodPaths))
return true;
if (super.isAllowedFolderAllExpand(this._nodPlacemarks))
return true;
if (super.isAllowedFolderAllExpand(this._nodPoints))
return true;
if (super.isAllowedFolderAllExpand(this._nodPointsets))
return true;
if (super.isAllowedFolderAllExpand(this._nodSegmentWiseYes))
return true;
return false;
}
@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._nodSegmentWiseYes != null)
{
// TODO: iterate through children, remove
this._nodSegmentWiseYes.destroy();
this._nodSegmentWiseYes = null;
}
if (this._nodPlacemarks != null)
{
// TODO: iterate through children, remove
this._nodPlacemarks.destroy();
this._nodPlacemarks = null;
}
if (this._nodPoints != null)
{
// TODO: iterate through children, remove
this._nodPoints.destroy();
this._nodPoints = null;
}
if (this._nodPointsets != null)
{
// TODO: iterate through children, remove
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._nodSegmentWiseYes != null)
{
// TODO: iterate through children, remove
this._nodSegmentWiseYes.destroy();
this._nodSegmentWiseYes = null;
}
if (this._nodPlacemarks != null)
{
// TODO: iterate through children, remove
this._nodPlacemarks.destroy();
this._nodPlacemarks = null;
}
if (this._nodPoints != null)
{
// TODO: iterate through children, remove
this._nodPoints.destroy();
this._nodPoints = 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();
GfrNodCtrFixFolderRootAbs nodRoot = (GfrNodCtrFixFolderRootAbs) objRoot;
nodRoot.setTree(this);
if (! this._nodSectors.init())
throw new Exception("! this._nodSectors.init()");
if (! this._nodAreas.init())
throw new Exception("! this._nodAreas.init()");
if (! this._nodPaths.init())
throw new Exception("! this._nodPaths.init()");
if (! this._nodSegmentWiseYes.init())
throw new Exception("! this._nodSegmentWiseYes.init()");
if (! this._nodPlacemarks.init())
throw new Exception("! this._nodPlacemarks.init()");
if (! this._nodPoints.init())
throw new Exception("! this._nodPoints.init()");
if (! this._nodPointsets.init())
throw new Exception("! this._nodPointsets.init()");
DefaultTreeModel dtm = (DefaultTreeModel) super.getModel();
dtm.insertNodeInto(this._nodPointsets, nodRoot, 0);
dtm.insertNodeInto(this._nodPlacemarks, nodRoot, 0);
dtm.insertNodeInto(this._nodPoints, nodRoot, 0);
dtm.insertNodeInto(this._nodSegmentWiseYes, nodRoot, 0);
dtm.insertNodeInto(this._nodPaths, nodRoot, 0);
dtm.insertNodeInto(this._nodAreas, nodRoot, 0);
dtm.insertNodeInto(this._nodSectors, nodRoot, 0);
dtm.nodeStructureChanged(nodRoot);
// beg this order
if (super.isVisible())
super.expandAll();
super.setRootVisible(false);
// end this order
this._nodSectors.addAllObjects();
this._nodAreas.addAllObjects();
this._nodPaths.addAllObjects();
this._nodSegmentWiseYes.addAllObjects();
this._nodPoints.addAllObjects();
this._nodPlacemarks.addAllObjects();
this._nodPointsets.addAllObjects();
}
}