/*
* 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 java.util.logging.Logger;
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.GfrTreCtrTopSpcTogChkPrjSelCatTlosAbs;
import org.geoforge.guillc.treenode.GfrNodCtrFixFolderRootAbs;
import org.geoforge.guillc.treenode.GfrNodCtrFixFolderTopPrjSelAbs;
import org.geoforge.guillcogcecl.treenode.*;
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
*
*/
public class GfrTreCtrTopSpcTogChkPrjSelCatTlosEcl extends GfrTreCtrTopSpcTogChkPrjSelCatTlosAbs
{
// ----
// begin: instantiate logger for this class
final private static Logger _LOGGER_ = Logger.getLogger(GfrTreCtrTopSpcTogChkPrjSelCatTlosEcl.class.getName());
static
{
GfrTreCtrTopSpcTogChkPrjSelCatTlosEcl._LOGGER_.addHandler(FileHandlerLogger.s_getInstance());
}
// end: instantiate logger for this class
// ----
private GfrNodCtrFixFolderTopPrjSelAbs _nodSectors_ = null;
private GfrNodCtrFixFolderTopPrjSelAbs _nodAreas_ = null;
private GfrNodCtrFixFolderTopPrjSelAbs _nodPaths_ = null;
private GfrNodCtrFixFolderTopPrjSelAbs _nodSegmentsWiseYes_ = null;
private GfrNodCtrFixFolderTopPrjSelAbs _nodPlacemarks_ = null;
private GfrNodCtrFixFolderTopPrjSelAbs _nodPoints_ = null;
private GfrNodCtrFixFolderTopPrjSelAbs _nodPointsets_ = null;
public GfrTreCtrTopSpcTogChkPrjSelCatTlosEcl(
MouseListener alrParentCad,
java.awt.Color colBg,
TreeSelectionListener lstTreeSelectionToolbar,
TreeExpansionListener lstTreeExpansionToolbar,
TreeModelListener lstTreeModelToolbar,
ActionListener alrParentPanelMvc)
{
super(
alrParentCad,
new GfrNodCtrFixFolderRootChkSelPrjEcl(),
alrParentPanelMvc,
lstTreeSelectionToolbar,
lstTreeExpansionToolbar,
lstTreeModelToolbar
);
}
@Override
public void openSpaceApplicationProject(ActionListener alrControllerSpcPrj, ActionListener alrControllerPrs) throws Exception
{
super.openSpaceAny(alrControllerSpcPrj);
this._nodSectors_ = new GfrNodCtrFixFolderTopPrjSelLeavesScts(
alrControllerSpcPrj, alrControllerPrs, this, super._alrParentPanelMvc);
this._nodAreas_ = new GfrNodCtrFixFolderTopPrjSelLeavesAres(
alrControllerSpcPrj, alrControllerPrs, this, super._alrParentPanelMvc);
this._nodPaths_ = new GfrNodCtrFixFolderTopPrjSelLeavesPths(
alrControllerSpcPrj, alrControllerPrs, this, super._alrParentPanelMvc);
this._nodSegmentsWiseYes_ = new GfrNodCtrFixFolderTopPrjSelLeavesSegsWiseYes(
alrControllerSpcPrj, alrControllerPrs, this, super._alrParentPanelMvc);
this._nodPlacemarks_ = new GfrNodCtrFixFolderTopPrjSelLeavesPlcs(
alrControllerSpcPrj, alrControllerPrs, this, super._alrParentPanelMvc);
this._nodPoints_ = new GfrNodCtrFixFolderTopPrjSelLeavesPnts(
alrControllerSpcPrj, alrControllerPrs, this, super._alrParentPanelMvc);
this._nodPointsets_ = new GfrNodCtrFixFolderTopPrjSelLeavesSpns(
alrControllerSpcPrj, alrControllerPrs, this, super._alrParentPanelMvc);
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._nodSegmentsWiseYes_.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()");
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);
// beg this order
if (super.isVisible())
super.expandAll();
super.setRootVisible(false);
// end this order
this._nodSectors_.addAllObjects();
this._nodAreas_.addAllObjects();
this._nodPaths_.addAllObjects();
this._nodSegmentsWiseYes_.addAllObjects();
this._nodPoints_.addAllObjects();
this._nodPlacemarks_.addAllObjects();
this._nodPointsets_.addAllObjects();
}
@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._nodSegmentsWiseYes_ != null)
{
// TODO: iterate through children, remove
this._nodSegmentsWiseYes_.destroy();
this._nodSegmentsWiseYes_ = null;
}
if (this._nodPaths_ != null)
{
// TODO: iterate through children, remove
this._nodPaths_.destroy();
this._nodPaths_ = 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 boolean init()
{
if (! super.init())
return false;
return true;
}
@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;
}
}
@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._nodPaths_))
return true;
if (super.isAllowedFolderAllCollapse(this._nodSegmentsWiseYes_))
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._nodPaths_))
return true;
if (super.isAllowedFolderAllExpand(this._nodSegmentsWiseYes_))
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();
}
}