eu.essilab.lablib.checkboxtree.SimpleTreeCheckingMode Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of lablib-checkboxtree Show documentation
Show all versions of lablib-checkboxtree Show documentation
CheckboxTree is a Java Swing component providing a tree-like widget with checkboxes in
each node. Checkboxes can toggle between the checked and unchecked state. Disabled
and greyed checkboxes are also supported. The CheckboxTree API design is inspired by
the JTree interface.
The newest version!
/*
* Copyright 2007-2022 Enrico Boldrini, Lorenzo Bigagli This file is part of
* CheckboxTree. CheckboxTree is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or (at your
* option) any later version. CheckboxTree 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 General
* Public License for more details. You should have received a copy of the GNU
* General Public License along with CheckboxTree; if not, write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA
*/
package eu.essilab.lablib.checkboxtree;
import javax.swing.tree.TreePath;
/**
* SimpleTreeCheckingMode defines a TreeCheckingMode without recursion. In this
* simple mode the check state always changes only the current node: no
* recursion.
*
* @author Enrico Boldrini
*/
public class SimpleTreeCheckingMode extends TreeCheckingMode {
SimpleTreeCheckingMode(DefaultTreeCheckingModel model) {
super(model);
}
@Override
public void checkPath(TreePath path) {
this.model.addToCheckedPathsSet(path);
this.model.updatePathGreyness(path);
this.model.updateAncestorsGreyness(path);
}
@Override
public void uncheckPath(TreePath path) {
this.model.removeFromCheckedPathsSet(path);
this.model.updatePathGreyness(path);
this.model.updateAncestorsGreyness(path);
}
/*
* (non-Javadoc)
*
* @seeit.cnr.imaa.essi.lablib.gui.checkboxtree.TreeCheckingMode#
* updateCheckAfterChildrenInserted(javax.swing.tree.TreePath)
*/
@Override
public void updateCheckAfterChildrenInserted(TreePath parent) {
this.model.updatePathGreyness(parent);
this.model.updateAncestorsGreyness(parent);
}
/*
* (non-Javadoc)
*
* @seeit.cnr.imaa.essi.lablib.gui.checkboxtree.TreeCheckingMode#
* updateCheckAfterChildrenRemoved(javax.swing.tree.TreePath)
*/
@Override
public void updateCheckAfterChildrenRemoved(TreePath parent) {
this.model.updatePathGreyness(parent);
this.model.updateAncestorsGreyness(parent);
}
/*
* (non-Javadoc)
*
* @seeit.cnr.imaa.essi.lablib.gui.checkboxtree.TreeCheckingMode#
* updateCheckAfterStructureChanged(javax.swing.tree.TreePath)
*/
@Override
public void updateCheckAfterStructureChanged(TreePath parent) {
this.model.updatePathGreyness(parent);
this.model.updateAncestorsGreyness(parent);
}
}