diff --git a/tools/src/it/cnr/imaa/essi/lablib/gui/checkboxtree/CheckboxTree.java b/tools/src/it/cnr/imaa/essi/lablib/gui/checkboxtree/CheckboxTree.java
deleted file mode 100644
index 12eb6ff28f..0000000000
--- a/tools/src/it/cnr/imaa/essi/lablib/gui/checkboxtree/CheckboxTree.java
+++ /dev/null
@@ -1,352 +0,0 @@
-/*
- * Copyright 2006,2007 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 it.cnr.imaa.essi.lablib.gui.checkboxtree;
-
-import java.awt.Rectangle;
-import java.awt.event.MouseAdapter;
-import java.awt.event.MouseEvent;
-
-import javax.swing.JTree;
-import javax.swing.tree.TreeCellRenderer;
-import javax.swing.tree.TreeModel;
-import javax.swing.tree.TreeNode;
-import javax.swing.tree.TreePath;
-import javax.swing.tree.TreeSelectionModel;
-
-/**
- * A tree whose nodes may be checked (e.g. the component usually found in
- * software installers, that allows for selecting the features to
- * install/uninstall). If a node has some child of different checking status is
- * greyed. You can use the same constructors of Jtree to instantiate a new
- * CheckboxTree Example from a TreeNode:
- *
- *
- * DefaultMutableTreeNode root = new DefaultMutableTreeNode("root");
- * root.add(new DefaultMutableTreeNode("child A"));
- * root.add(new DefaultMutableTreeNode("child B"));
- * CheckboxTree CheckboxTree = new CheckboxTree(root);
- *
- *
- * Example from a TreeModel:
- *
- *
- * DefaultTreeModel dtm = new DefaultTreeModel(root);
- *
- * CheckboxTree CheckboxTree = new CheckboxTree(root);
- *
- *
- * Default constructor (useful for gui builders):
- *
- *
- * CheckboxTree CheckboxTree = new CheckboxTree();
- *
- *
- * Then you can set the checking propagation style:
- *
- *
- * CheckboxTree.getCheckingModel().setCheckingMode(TreeCheckingModel.CheckingMode.SIMPLE);
- * CheckboxTree.getCheckingModel().setCheckingMode(TreeCheckingModel.CheckingMode.PROPAGATE);
- * CheckboxTree.getCheckingModel().setCheckingMode(TreeCheckingModel.CheckingMode.PROPAGATE_PRESERVING_CHECK);
- * CheckboxTree.getCheckingModel().setCheckingMode(TreeCheckingModel.CheckingMode.PROPAGATE_PRESERVING_UNCHECK);
- *
- *
- * You can also set the model at a later time using:
- *
- *
- * CheckboxTree.setModel(aTreeModel);
- *
- *
- * There are two methods that return the paths that are in the checking:
- *
- *
- * TreePath[] tp = CheckboxTree.getCheckingPaths();
- *
- * TreePath[] tp = CheckboxTree.getCheckingRoots();
- *
- *
- * You can also add/remove a listener of a TreeCheckingEvent in this way:
- *
- *
- * CheckboxTree.addTreeCheckingListener(new TreeCheckingListener() {
- * public void valueChanged(TreeCheckingEvent e) {
- * System.out.println("Checked paths changed: user clicked on " + (e.getLeadingPath().getLastPathComponent()));
- * }
- * });
- *
- *
- * @author Enrico Boldrini
- * @author Lorenzo Bigagli
- */
-
-public class CheckboxTree extends JTree {
-
- private TreeCheckingModel checkingModel;
-
- private class NodeCheckListener extends MouseAdapter {
- @Override
- public void mousePressed(MouseEvent e) {
- // we use mousePressed instead of mouseClicked for performance
- int x = e.getX();
- int y = e.getY();
- int row = getRowForLocation(x, y);
- if (row == -1) {
- // click outside any node
- return;
- }
- Rectangle rect = getRowBounds(row);
- if (rect == null) {
- // clic on an invalid node
- return;
- }
- if (((CheckboxTreeCellRenderer) getCellRenderer()).isOnHotspot(x - rect.x, y - rect.y)) {
- getCheckingModel().toggleCheckingPath(getPathForRow(row));
- }
- }
- }
-
- /**
- * For GUI builders. It returns a CheckboxTree with a default tree
- * model to show something interesting. Creates a CheckboxTree with
- * visible handles, a default CheckboxTreeCellRenderer and a default
- * TreeCheckingModel.
- */
- public CheckboxTree() {
- super(getDefaultTreeModel());
- initialize();
- }
-
- /**
- * Creates a CheckboxTree with visible handles, a default
- * CheckboxTreeCellRenderer and a default TreeCheckingModel. The tree is
- * created using the specified data model. Mouse clicks are validated
- * against the cell renderer (via isOnCheckBox) and, eventually, passed
- * on to the checking model.
- *
- * @param root the root of the tree
- */
- public CheckboxTree(TreeNode root) {
- super(root);
- initialize();
- }
-
- /**
- * Creates a CheckboxTree with visible handles, a default
- * CheckboxTreeCellRenderer and a default TreeCheckingModel. The tree is
- * created using the specified data model. Mouse clicks are validated
- * against the cell renderer (via isOnCheckBox) and, eventually, passed
- * on to the checking model.
- */
- public CheckboxTree(TreeModel treemodel) {
- super(treemodel);
- initialize();
- }
-
- /**
- * Convenience initialization method.
- */
- private void initialize() {
- setCheckingModel(new DefaultTreeCheckingModel(this.treeModel));
- setCellRenderer(new DefaultCheckboxTreeCellRenderer());
- addMouseListener(new NodeCheckListener());
- this.selectionModel.setSelectionMode(TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION);
- setShowsRootHandles(true);
- putClientProperty("JTree.lineStyle", "Angled");// for Metal L&F
- }
-
- /**
- * Sets the CheckboxTreeCellRenderer
that will be used to
- * draw each cell.
- *
- * @param x the TreeCellRenderer
that is to render each
- * cell
- * @beaninfo bound: true description: The TreeCellRenderer that will be
- * used to draw each cell.
- */
- public void setCellRenderer(CheckboxTreeCellRenderer x) {
- super.setCellRenderer(x);
- }
-
- /**
- * Sets the TreeCellRenderer
that will be used to draw
- * each cell. This method is deprecated. Use the other setter for
- * {@link CheckboxTreeCellRenderer}
- *
- * @param x the TreeCellRenderer
that is to render each
- * cell
- * @beaninfo bound: true description: The TreeCellRenderer that will be
- * used to draw each cell.
- */
- @Override
- @Deprecated
- public void setCellRenderer(TreeCellRenderer x) {
- super.setCellRenderer(x);
- }
-
- /**
- * Sets the TreeModel and links it to the existing checkingModel.
- */
- @Override
- public void setModel(TreeModel newModel) {
- super.setModel(newModel);
- if (this.checkingModel != null) {
- this.checkingModel.setTreeModel(newModel);
- }
- }
-
- /**
- * @return Returns the TreeCheckingModel.
- */
- public TreeCheckingModel getCheckingModel() {
- return this.checkingModel;
- }
-
- /**
- * Set the checking model of this CheckboxTree.
- *
- * @param newCheckingModel The new TreeCheckingModel.
- */
- public void setCheckingModel(TreeCheckingModel newCheckingModel) {
- /*
- * we must unlink the old TreeCheckingModel from the model of this tree
- * and link the new one to it.
- */
- TreeCheckingModel oldCheckingModel = this.checkingModel;
- if (oldCheckingModel != null) {
- // null the model in the old TreeCheckingModel to avoid dangling
- // pointers
- oldCheckingModel.setTreeModel(null);
- }
- // TODO: check newCheckingModel for == null and optionally substitute
- // with EmptyCheckingModel...
- this.checkingModel = newCheckingModel;
- if (newCheckingModel != null) {
- newCheckingModel.setTreeModel(getModel());
- // add a treeCheckingListener to repaint upon checking
- // modifications
- newCheckingModel.addTreeCheckingListener(new TreeCheckingListener() {
- public void valueChanged(TreeCheckingEvent e) {
- repaint();
- }
- });
- }
- }
-
- /**
- * Return paths that are in the checking.
- */
- public TreePath[] getCheckingPaths() {
- return getCheckingModel().getCheckingPaths();
- }
-
- /**
- * @return Returns the paths that are in the checking set and are the
- * (upper) roots of checked trees.
- */
- public TreePath[] getCheckingRoots() {
- return getCheckingModel().getCheckingRoots();
- }
-
- /**
- * Clears the checking.
- */
- public void clearChecking() {
- getCheckingModel().clearChecking();
- }
-
- /**
- * Add paths in the checking.
- */
- public void addCheckingPaths(TreePath[] paths) {
- getCheckingModel().addCheckingPaths(paths);
- }
-
- /**
- * Add a path in the checking.
- */
- public void addCheckingPath(TreePath path) {
- getCheckingModel().addCheckingPath(path);
- }
-
- /**
- * Set path in the checking.
- */
- public void setCheckingPath(TreePath path) {
- getCheckingModel().setCheckingPath(path);
- }
-
- /**
- * Set paths that are in the checking.
- */
- public void setCheckingPaths(TreePath[] paths) {
- getCheckingModel().setCheckingPaths(paths);
- }
-
- /**
- * @return Returns the paths that are in the greying.
- */
- public TreePath[] getGreyingPaths() {
- return getCheckingModel().getGreyingPaths();
- }
-
- /**
- * Adds a listener for TreeChecking
events.
- *
- * @param tsl the TreeCheckingListener
that will be
- * notified when a node is checked
- */
- public void addTreeCheckingListener(TreeCheckingListener tsl) {
- this.checkingModel.addTreeCheckingListener(tsl);
- }
-
- /**
- * Removes a TreeChecking
listener.
- *
- * @param tsl the TreeChckingListener
to remove
- */
- public void removeTreeCheckingListener(TreeCheckingListener tsl) {
- this.checkingModel.removeTreeCheckingListener(tsl);
- }
-
- /**
- * Expand completely a tree
- */
- public void expandAll() {
- expandSubTree(getPathForRow(0));
- }
-
- private void expandSubTree(TreePath path) {
- expandPath(path);
- Object node = path.getLastPathComponent();
- int childrenNumber = getModel().getChildCount(node);
- TreePath[] childrenPath = new TreePath[childrenNumber];
- for (int childIndex = 0; childIndex < childrenNumber; childIndex++) {
- childrenPath[childIndex] = path.pathByAddingChild(getModel().getChild(node, childIndex));
- expandSubTree(childrenPath[childIndex]);
- }
- }
-
- /**
- * @return a string representation of the tree, including the checking,
- * enabling and greying sets.
- */
- @Override
- public String toString() {
- String retVal = super.toString();
- TreeCheckingModel tcm = getCheckingModel();
- if (tcm != null) {
- return retVal + "\n" + tcm.toString();
- }
- return retVal;
- }
-}
diff --git a/tools/src/it/cnr/imaa/essi/lablib/gui/checkboxtree/CheckboxTreeCellRenderer.java b/tools/src/it/cnr/imaa/essi/lablib/gui/checkboxtree/CheckboxTreeCellRenderer.java
deleted file mode 100644
index c2bdcda558..0000000000
--- a/tools/src/it/cnr/imaa/essi/lablib/gui/checkboxtree/CheckboxTreeCellRenderer.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright 2006,2007 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 it.cnr.imaa.essi.lablib.gui.checkboxtree;
-
-import java.awt.Component;
-
-import javax.swing.JTree;
-import javax.swing.tree.TreeCellRenderer;
-
-/**
- * The renderer for a cell in a CheckboxTree.
- *
- * @author bigagli
- */
-public interface CheckboxTreeCellRenderer extends TreeCellRenderer {
-
- /**
- * This method is redeclared just to underline that the implementor has
- * to properly display the checking/graying state of value
.
- * This should go in the method parameters, but would imply changes to
- * Swing classes that were considered unpractical. For example in
- * DefaultCheckboxTreeCellRenderer the following code is used to get the
- * checking/graying states:
- *
- *
- * TreeCheckingModel checkingModel = ((CheckboxTree) tree).getCheckingModel();
- *
- * TreePath path = tree.getPathForRow(row);
- *
- * boolean enabled = checkingModel.isPathEnabled(path);
- *
- * boolean checked = checkingModel.isPathChecked(path);
- *
- * boolean greyed = checkingModel.isPathGreyed(path);
- *
- *
- * You could use a QuadristateCheckbox to properly renderer the states
- * (as in DefaultCheckboxTreeCellRenderer).
- *
- * @see TreeCellRenderer#getTreeCellRendererComponent
- */
- Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row,
- boolean hasFocus);
-
- /**
- * Returns whether the specified relative coordinates insist on the
- * intended checkbox control. May be used by a mouse listener to figure
- * out whether to toggle a node or not.
- */
- public boolean isOnHotspot(int x, int y);
-
-}
diff --git a/tools/src/it/cnr/imaa/essi/lablib/gui/checkboxtree/DefaultCheckboxTreeCellRenderer.java b/tools/src/it/cnr/imaa/essi/lablib/gui/checkboxtree/DefaultCheckboxTreeCellRenderer.java
deleted file mode 100644
index 56ee970c47..0000000000
--- a/tools/src/it/cnr/imaa/essi/lablib/gui/checkboxtree/DefaultCheckboxTreeCellRenderer.java
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
- * Copyright 2006,2007 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 it.cnr.imaa.essi.lablib.gui.checkboxtree;
-
-import it.cnr.imaa.essi.lablib.gui.checkboxtree.QuadristateButtonModel.State;
-
-import java.awt.Color;
-import java.awt.Component;
-import java.awt.Dimension;
-import java.awt.FlowLayout;
-
-import javax.swing.Icon;
-import javax.swing.ImageIcon;
-import javax.swing.JPanel;
-import javax.swing.JTree;
-import javax.swing.UIManager;
-import javax.swing.plaf.ColorUIResource;
-import javax.swing.tree.DefaultTreeCellRenderer;
-import javax.swing.tree.TreePath;
-
-/**
- * A renderer for the CheckboxTree. This implementation decorates a
- * DefaultTreeCellRenderer (i.e. a JLabel) with a checkbox, by adding a
- * JCheckbox to the former onto a JPanel. Both can be overridden by subclasses.
- * Note that this renderer separates the checkbox form the label/icon, in that
- * double-clicking the label/icon of this renderer does not toggle the checkbox.
- *
- * @author boldrini
- * @author bigagli
- */
-public class DefaultCheckboxTreeCellRenderer extends JPanel implements CheckboxTreeCellRenderer {
-
- protected QuadristateCheckbox checkBox = new QuadristateCheckbox();
-
- protected DefaultTreeCellRenderer label = new DefaultTreeCellRenderer();
-
- public DefaultCheckboxTreeCellRenderer() {
- this.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
- add(this.checkBox);
- add(this.label);
- this.checkBox.setBackground(UIManager.getColor("Tree.textBackground"));
- this.setBackground(UIManager.getColor("Tree.textBackground"));
- }
-
- // @Override
- // public void doLayout() {
- // Dimension d_check = this.checkBox.getPreferredSize();
- // Dimension d_label = this.label.getPreferredSize();
- // int y_check = 0;
- // int y_label = 0;
- // if (d_check.height < d_label.height) {
- // y_check = (d_label.height - d_check.height) / 2;
- // } else {
- // y_label = (d_check.height - d_label.height) / 2;
- // }
- // this.checkBox.setLocation(0, y_check);
- // this.checkBox.setBounds(0, y_check, d_check.width, d_check.height);
- // this.label.setLocation(d_check.width, y_label);
- // this.label.setBounds(d_check.width, y_label, d_label.width,
- // d_label.height);
- // }
-
- @Override
- public Dimension getPreferredSize() {
- Dimension d_check = this.checkBox.getPreferredSize();
- Dimension d_label = this.label.getPreferredSize();
- return new Dimension(d_check.width + d_label.width, (d_check.height <
- d_label.height ? d_label.height : d_check.height));
- }
-
- /**
- * Decorates this renderer based on the passed in components.
- */
- public Component getTreeCellRendererComponent(JTree tree, Object object, boolean selected, boolean expanded, boolean leaf, int row,
- boolean hasFocus) {
- /*
- * most of the rendering is delegated to the wrapped
- * DefaultTreeCellRenderer, the rest depends on the TreeCheckingModel
- */
- this.label.getTreeCellRendererComponent(tree, object, selected, expanded, leaf, row, hasFocus);
- if (tree instanceof CheckboxTree) {
- TreeCheckingModel checkingModel = ((CheckboxTree) tree).getCheckingModel();
- TreePath path = tree.getPathForRow(row);
- this.checkBox.setEnabled(checkingModel.isPathEnabled(path));
- boolean checked = checkingModel.isPathChecked(path);
- boolean greyed = checkingModel.isPathGreyed(path);
- if (checked && !greyed) {
- this.checkBox.setState(State.CHECKED);
- }
- if (!checked && greyed) {
- this.checkBox.setState(State.GREY_UNCHECKED);
- }
- if (checked && greyed) {
- this.checkBox.setState(State.GREY_CHECKED);
- }
- if (!checked && !greyed) {
- this.checkBox.setState(State.UNCHECKED);
- }
- }
- return this;
- }
-
- /**
- * Checks if the (x,y) coordinates are on the Checkbox.
- *
- * @return boolean
- * @param x
- * @param y
- */
- public boolean isOnHotspot(int x, int y) {
- // TODO: alternativa (ma funge???)
- //return this.checkBox.contains(x, y);
- return (this.checkBox.getBounds().contains(x, y));
- }
-
- /**
- * Loads an ImageIcon from the file iconFile, searching it in the
- * classpath.Guarda un po'
- */
- protected static ImageIcon loadIcon(String iconFile) {
- try {
- return new ImageIcon(DefaultCheckboxTreeCellRenderer.class.getClassLoader().getResource(iconFile));
- } catch (NullPointerException npe) { // did not find the resource
- return null;
- }
- }
-
- @Override
- public void setBackground(Color color) {
- if (color instanceof ColorUIResource) {
- color = null;
- }
- super.setBackground(color);
- }
-
- /**
- * Sets the icon used to represent non-leaf nodes that are expanded.
- */
- public void setOpenIcon(Icon newIcon) {
- this.label.setOpenIcon(newIcon);
- }
-
- /**
- * Sets the icon used to represent non-leaf nodes that are not expanded.
- */
- public void setClosedIcon(Icon newIcon) {
- this.label.setClosedIcon(newIcon);
- }
-
- /**
- * Sets the icon used to represent leaf nodes.
- */
- public void setLeafIcon(Icon newIcon) {
- this.label.setLeafIcon(newIcon);
- }
-
-}
\ No newline at end of file
diff --git a/tools/src/it/cnr/imaa/essi/lablib/gui/checkboxtree/DefaultTreeCheckingModel.java b/tools/src/it/cnr/imaa/essi/lablib/gui/checkboxtree/DefaultTreeCheckingModel.java
deleted file mode 100644
index faa31a1538..0000000000
--- a/tools/src/it/cnr/imaa/essi/lablib/gui/checkboxtree/DefaultTreeCheckingModel.java
+++ /dev/null
@@ -1,749 +0,0 @@
-/*
- * Copyright 2006,2007 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 it.cnr.imaa.essi.lablib.gui.checkboxtree;
-
-import java.util.HashSet;
-import java.util.Vector;
-
-import javax.swing.event.EventListenerList;
-import javax.swing.event.TreeModelEvent;
-import javax.swing.event.TreeModelListener;
-import javax.swing.tree.TreeModel;
-import javax.swing.tree.TreePath;
-
-//import org.eevolution.model.X_PP_Product_BOMLine;
-
-/**
- * The default tree checking model provides: - methods for store checked
- * TreePaths and retrieve them. It doesn't provide the implementation of
- * addCheckingPath and removeCheckingPath methods (are delegated to
- * CheckingMode). This implementation is based on TreePath only and does not
- * take advantage of TreeNode convenience methods. Alternative implementation
- * may assume that the tree nodes be TreeNode instances.
- *
- * @author Bigagli
- * @author Boldrini
- */
-public class DefaultTreeCheckingModel implements TreeCheckingModel {
-
- private HashSet checkedPathsSet;
-
- private HashSet greyedPathsSet;
-
- private HashSet disabledPathsSet;
-
- private HashSet checkBoxPathsSet;
-
- private PropagateCheckingListener propagateCheckingListener;
-
- protected TreeCheckingMode checkingMode;
-
- protected TreeModel model;
-
- /** Event listener list. */
- protected EventListenerList listenerList = new EventListenerList();
-
- /**
- * Creates a DefaultTreeCheckingModel with PropagateTreeCheckingMode.
- */
- public DefaultTreeCheckingModel(TreeModel model) {
- this.model = model;
- this.checkedPathsSet = new HashSet();
- this.greyedPathsSet = new HashSet();
- this.disabledPathsSet = new HashSet();
- this.checkBoxPathsSet = new HashSet();
- this.propagateCheckingListener = new PropagateCheckingListener();
- this.setCheckingMode(CheckingMode.PROPAGATE);
- }
-
- /**
- * @deprecated
- */
- @Deprecated
- public TreeModelListener getTreeModelListener() {
- return null;
- }
-
- public void setCheckedPathsSet(HashSet checkedPathsSet) {
- this.checkedPathsSet = checkedPathsSet;
- }
-
- public void setGreyedPathsSet(HashSet greyedPathsSet) {
- this.greyedPathsSet = greyedPathsSet;
- }
-
- public void setDisabledPathsSet(HashSet disabledPathsSet) {
- this.disabledPathsSet = disabledPathsSet;
- }
-
- public void setCheckBoxPathsSet(HashSet checkBoxPathsSet) {
- this.checkBoxPathsSet = checkBoxPathsSet;
- }
-
-
- private class PropagateCheckingListener implements TreeModelListener {
- /**
- * Updates the check of the just inserted nodes.
- */
- public void treeNodesInserted(TreeModelEvent e) {
- TreePath path = e.getTreePath();
- DefaultTreeCheckingModel.this.checkingMode.updateCheckAfterChildrenInserted(path);
- }
-
- /**
- * Nothing to do if nodes were removed.
- */
- public void treeNodesRemoved(TreeModelEvent e) {
- TreePath path = e.getTreePath();
- DefaultTreeCheckingModel.this.checkingMode.updateCheckAfterChildrenRemoved(path);
- }
-
- /**
- * Updates the tree greyness in case of nodes changes.
- */
- public void treeNodesChanged(TreeModelEvent e) {
- TreePath path = e.getTreePath();
- updateSubTreeGreyness(path);
- updateAncestorsGreyness(path);
- }
-
- /**
- * Updates the tree greyness in case of structure changes.
- */
- public void treeStructureChanged(TreeModelEvent e) {
- TreePath path = e.getTreePath();
- DefaultTreeCheckingModel.this.checkingMode.updateCheckAfterStructureChanged(path);
- }
- }
-
- /**
- * Updates consistency of the checking. It's based on paths greyness.
- */
- public void updateCheckingConsistency() {
- updateSubTreeCheckingConsistency(new TreePath(this.model.getRoot()));
- }
-
- /**
- * Updates consistency of the checking of sub-tree starting at path.
- * It's based on paths greyness. TODO: test this method, never used
- *
- * @param path the root of the sub-tree to be grey-updated
- */
- public void updateSubTreeCheckingConsistency(TreePath path) {
- if (isPathGreyed(path)) {
- // greyed
- for (TreePath childPath : getChildrenPath(path)) {
- updateSubTreeCheckingConsistency(childPath);
- }
- updatePathGreyness(path);
- } else {
- // not greyed
- if (isPathChecked(path)) {
- checkSubTree(path);
- } else {
- uncheckSubTree(path);
- }
- return;
- }
- }
-
- public boolean isPathCheckBox(TreePath path) {
- return this.checkBoxPathsSet.contains(path);
- }
-
- public boolean isPathChecked(TreePath path) {
- return this.checkedPathsSet.contains(path);
- }
-
- public boolean isPathEnabled(TreePath path) {
- return !this.disabledPathsSet.contains(path);
- }
-
- public boolean isPathGreyed(TreePath path) {
- return this.greyedPathsSet.contains(path);
- }
-
- void addToGreyedPathsSet(TreePath path) {
- this.greyedPathsSet.add(path);
- }
-
- void removeFromGreyedPathsSet(TreePath path) {
- this.greyedPathsSet.remove(path);
- }
-
- /**
- * Sets whether or not the path is enabled.
- *
- * @param path the path to enable/disable
- */
- public void setPathEnabled(TreePath path, boolean enable) {
- if (enable) {
- this.disabledPathsSet.remove(path);
- } else {
- this.disabledPathsSet.add(path);
- }
- }
-
- /**
- * Sets whether or not the paths are enabled.
- *
- * @param paths the paths to enable/disable
- */
- public void setPathsEnabled(TreePath[] paths, boolean enable) {
- for (TreePath path : paths) {
- setPathEnabled(path, enable);
- }
- }
-
- public void addToCheckBoxPathsSet(TreePath path) {
- this.checkBoxPathsSet.add(path);
- }
-
- void addToCheckedPathsSet(TreePath path) {
- this.checkedPathsSet.add(path);
- }
-
- void removeFromCheckedPathsSet(TreePath path) {
- this.checkedPathsSet.remove(path);
- }
-
- /**
- * Ungreys the subtree with root path.
- *
- * @param path root of the tree to be checked
- */
- public void ungreySubTree(TreePath path) {
- removeFromGreyedPathsSet(path);
- for (TreePath childPath : getChildrenPath(path)) {
- ungreySubTree(childPath);
- }
- }
-
- /**
- * Checks the subtree with root path.
- *
- * @param path root of the tree to be checked
- */
- public void checkSubTree(final TreePath path) {
- addToCheckedPathsSet(path);
- removeFromGreyedPathsSet(path);
- Object node = path.getLastPathComponent();
- int childrenNumber = this.model.getChildCount(node);
- for (int childIndex = 0; childIndex < childrenNumber; childIndex++) {
- TreePath childPath = path.pathByAddingChild(this.model.getChild(node, childIndex));
- checkSubTree(childPath);
- }
- }
-
- /**
- * Unchecks the subtree with root path.
- *
- * @param path root of the tree to be unchecked
- */
- public void uncheckSubTree(TreePath path) {
- removeFromCheckedPathsSet(path);
- removeFromGreyedPathsSet(path);
- Object node = path.getLastPathComponent();
- int childrenNumber = this.model.getChildCount(node);
- for (int childIndex = 0; childIndex < childrenNumber; childIndex++) {
- TreePath childPath = path.pathByAddingChild(this.model.getChild(node, childIndex));
- uncheckSubTree(childPath);
- }
- }
-
- /**
- * Delegates to the current checkingMode the toggling style, using the
- * Strategy Pattern.
- */
- public void toggleCheckingPath(TreePath path) {
- if (!isPathEnabled(path)) {
- return;
- }
- if (isPathChecked(path)) {
- removeCheckingPath(path);
- } else {
- addCheckingPath(path);
- }
-
- }
-
- /**
- * Sets the checking to path.
- */
- public void setCheckingPath(TreePath path) {
- clearChecking();
- addCheckingPath(path);
- }
-
- /**
- * Sets the checking to paths.
- */
- public void setCheckingPaths(TreePath[] paths) {
- clearChecking();
- for (TreePath path : paths) {
- addCheckingPath(path);
- }
- }
-
- /**
- * Clears the checking.
- */
- public void clearChecking() {
- this.checkedPathsSet.clear();
- this.greyedPathsSet.clear();
- fireValueChanged(new TreeCheckingEvent(new TreePath(model.getRoot())));
- }
-
- /**
- * @return The paths that are in the greying.
- */
- public TreePath[] getGreyingPaths() {
- return greyedPathsSet.toArray(new TreePath[greyedPathsSet.size()]);
- }
-
- /**
- * @return Returns the paths that are in the checking.
- */
- public TreePath[] getCheckingPaths() {
- return checkedPathsSet.toArray(new TreePath[checkedPathsSet.size()]);
- }
-
- /**
- * @return Returns the paths that are in the checking set and are the
- * (upper) roots of checked trees.
- */
- public TreePath[] getCheckingRoots() {
- Vector roots = getCheckingRoots(new TreePath(this.model.getRoot()));
- return roots.toArray(new TreePath[] {});
- }
-
- /**
- * @param path
- * @return
- */
- private Vector getCheckingRoots(TreePath path) {
- Object node = path.getLastPathComponent();
- Vector roots = new Vector();
- if (!isPathGreyed(path)) {
- if (isPathChecked(path)) {
- roots.add(path);
- }
- return roots;
- }
- // path is greyed
- int childrenNumber = this.model.getChildCount(node);
- for (int childIndex = 0; childIndex < childrenNumber; childIndex++) {
- TreePath childPath = path.pathByAddingChild(this.model.getChild(node, childIndex));
- roots.addAll(getCheckingRoots(childPath));
- }
- return roots;
- }
-
- /**
- * @return The CheckingMode.
- */
- public CheckingMode getCheckingMode() {
- if (this.checkingMode instanceof SimpleTreeCheckingMode) {
- return CheckingMode.SIMPLE;
- }
- if (this.checkingMode instanceof PropagateTreeCheckingMode) {
- return CheckingMode.PROPAGATE;
- }
- if (this.checkingMode instanceof PropagatePreservingCheckTreeCheckingMode) {
- return CheckingMode.PROPAGATE_PRESERVING_CHECK;
- }
- if (this.checkingMode instanceof PropagatePreservingUncheckTreeCheckingMode) {
- return CheckingMode.PROPAGATE_PRESERVING_UNCHECK;
- }
- if (this.checkingMode instanceof PropagateUpWhiteTreeCheckingMode) {
- return CheckingMode.PROPAGATE_UP_UNCHECK;
- }
- return null;
- }
-
- /**
- * Sets the specified checking mode. The consistence of the existing
- * checking is not enforced nor controlled.
- */
- public void setCheckingMode(CheckingMode mode) {
- /*
- * CheckingMode implements togglePath method. (Strategy Pattern was
- * used).
- */
- switch (mode) {
- case SIMPLE:
- this.checkingMode = new SimpleTreeCheckingMode(this);
- break;
- case PROPAGATE:
- this.checkingMode = new PropagateTreeCheckingMode(this);
- break;
- case PROPAGATE_PRESERVING_CHECK:
- this.checkingMode = new PropagatePreservingCheckTreeCheckingMode(this);
- break;
- case PROPAGATE_PRESERVING_UNCHECK:
- this.checkingMode = new PropagatePreservingUncheckTreeCheckingMode(this);
- break;
- case PROPAGATE_UP_UNCHECK:
- this.checkingMode = new PropagateUpWhiteTreeCheckingMode(this);
- break;
- default:
- break;
- }
- // // TODO: safe to delete???
- // updateTreeGreyness();
- }
-
- /**
- * Sets the specified checking mode. The consistence of the existing
- * checking is not enforced nor controlled.
- */
- public void setCheckingMode(TreeCheckingMode mode) {
- this.checkingMode = mode;
- }
-
- /**
- * Adds the paths to the checked paths set
- *
- * @param paths the paths to be added.
- */
- public void addCheckingPaths(TreePath[] paths) {
- for (TreePath path : paths) {
- addCheckingPath(path);
- }
- }
-
- /**
- * Adds a path to the checked paths set
- *
- * @param path the path to be added.
- */
- public void addCheckingPath(TreePath path) {
- this.checkingMode.checkPath(path);
- TreeCheckingEvent event = new TreeCheckingEvent(path);
- fireValueChanged(event);
- }
-
- /**
- * Removes a path from the checked paths set
- *
- * @param path the path to be removed
- */
- public void removeCheckingPath(TreePath path) {
- this.checkingMode.uncheckPath(path);
- TreeCheckingEvent event = new TreeCheckingEvent(path);
- fireValueChanged(event);
- }
-
- /**
- * Removes the paths from the checked paths set
- *
- * @param paths the paths to be removed
- */
- public void removeCheckingPaths(TreePath[] paths) {
- for (TreePath path : paths) {
- removeCheckingPath(path);
- }
- }
-
- /**
- * Notifies all listeners that are registered for tree selection events
- * on this object.
- *
- * @see #addTreeCheckingListener
- * @see EventListenerList
- */
- protected void fireValueChanged(TreeCheckingEvent e) {
- // Guaranteed to return a non-null array
- Object[] listeners = this.listenerList.getListenerList();
- // Process the listeners last to first, notifying
- // those that are interested in this event
- for (int i = listeners.length - 2; i >= 0; i -= 2) {
- if (listeners[i] == TreeCheckingListener.class) {
- ((TreeCheckingListener) listeners[i + 1]).valueChanged(e);
- }
- }
- }
-
- /**
- * Adds x to the list of listeners that are notified each time the set
- * of checking TreePaths changes.
- *
- * @param x the new listener to be added
- */
- public void addTreeCheckingListener(TreeCheckingListener x) {
- this.listenerList.add(TreeCheckingListener.class, x);
- }
-
- /**
- * Removes x from the list of listeners that are notified each time the
- * set of checking TreePaths changes.
- *
- * @param x the listener to remove
- */
- public void removeTreeCheckingListener(TreeCheckingListener x) {
- this.listenerList.remove(TreeCheckingListener.class, x);
- }
-
- /**
- * Updates the greyness value value for the given path if there are
- * children with different values. Note: the greyness and cheking of
- * children MUST BE consistent.
- *
- * @param ancestor the path to be grey-updated.
- */
- protected void updatePathGreyness(TreePath ancestor) {
- boolean value = isPathCheckBox(ancestor);
- Object ancestorNode = ancestor.getLastPathComponent();
- if (!isPathCheckBox(ancestor)) {
- addToCheckBoxPathsSet(ancestor);
- return;
- }
- //X_PP_Product_BOMLine bomline = (X_PP_Product_BOMLine)ancestorNode;
- /*boolean value = isPathChecked(ancestor);
- int childrenNumber = this.model.getChildCount(ancestorNode);
- for (int childIndex = 0; childIndex < childrenNumber; childIndex++) {
- Object childNode = this.model.getChild(ancestorNode, childIndex);
- TreePath childPath = ancestor.pathByAddingChild(childNode);
- if (isPathGreyed(childPath)) {
- addToGreyedPathsSet(ancestor);
- return;
- }
- if (isPathChecked(childPath) != value) {
- addToGreyedPathsSet(ancestor);
- return;
- }
- }
- removeFromGreyedPathsSet(ancestor);
- */
- }
-
- /**
- * Updates the greyness of sub-tree starting at path.
- *
- * @param path the root of the sub-tree to be grey-updated
- */
- public void updateSubTreeGreyness(TreePath path) {
- /* if (pathHasChildrenWithValue(path, !isPathChecked(path))) {
- addToGreyedPathsSet(path);
- } else {
- removeFromGreyedPathsSet(path);
- }
- if (isPathGreyed(path)) {
- for (TreePath childPath : getChildrenPath(path)) {
- updateSubTreeGreyness(childPath);
- }
- return;
- } else {
- ungreySubTree(path);
- }
- */
- }
-
- /**
- * Updates the greyness state of the entire tree.
- */
- public void updateTreeGreyness() {
- updateSubTreeGreyness(new TreePath(this.model.getRoot()));
- }
-
- public enum ChildrenChecking {
- ALL_CHECKED, HALF_CHECKED, ALL_UNCHECKED, NO_CHILDREN
- }
-
- public ChildrenChecking getChildrenChecking(TreePath path) {
- Object node = path.getLastPathComponent();
- int childrenNumber = this.model.getChildCount(node);
- boolean someChecked = false;
- boolean someUnchecked = false;
- for (int childIndex = 0; childIndex < childrenNumber; childIndex++) {
- TreePath childPath = path.pathByAddingChild(this.model.getChild(node, childIndex));
- if (isPathGreyed(childPath)) {
- return ChildrenChecking.HALF_CHECKED;
- }
- // not greyed
- if (isPathChecked(childPath)) {
- if (someUnchecked) {
- return ChildrenChecking.HALF_CHECKED;
- }
- someChecked = true;
- } else {
- if (someChecked) {
- return ChildrenChecking.HALF_CHECKED;
- }
- someUnchecked = true;
- }
- }
- if (someChecked) {
- return ChildrenChecking.ALL_CHECKED;
- }
- if (someUnchecked) {
- return ChildrenChecking.ALL_UNCHECKED;
- }
- return ChildrenChecking.NO_CHILDREN;
- }
-
- /**
- * Note: The checking and the greyness of children MUST be consistent to
- * work properly.
- *
- * @return true if exists an unchecked node in the subtree of path.
- * @param path the root of the subtree to be checked.
- */
- public boolean pathHasUncheckedChildren(TreePath path) {
- Object node = path.getLastPathComponent();
- int childrenNumber = this.model.getChildCount(node);
- for (int childIndex = 0; childIndex < childrenNumber; childIndex++) {
- TreePath childPath = path.pathByAddingChild(this.model.getChild(node, childIndex));
- if (isPathGreyed(childPath) | !isPathChecked(childPath)) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * @return true if exists a checked node in the subtree of path.
- * @param path the root of the subtree to be checked.
- */
- public boolean pathHasCheckedChildren(TreePath path) {
- return pathHasChildrenWithValue(path, true);
- }
-
- /**
- * @return true if exists a node with checked status value in the
- * subtree of path.
- * @param path the root of the subtree to be searched.
- * @param value the value to be found.
- */
- protected boolean pathHasChildrenWithValue(TreePath path, boolean value) {
- Object node = path.getLastPathComponent();
- int childrenNumber = this.model.getChildCount(node);
- for (int childIndex = 0; childIndex < childrenNumber; childIndex++) {
- TreePath childPath = path.pathByAddingChild(this.model.getChild(node, childIndex));
- if (isPathChecked(childPath) == value) {
- return true;
- }
- }
- for (int childIndex = 0; childIndex < childrenNumber; childIndex++) {
- TreePath childPath = path.pathByAddingChild(this.model.getChild(node, childIndex));
- if (pathHasChildrenWithValue(childPath, value)) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * @return true if exists a child of node with a value different from
- * itself.
- * @param path the root path of the tree to be checked.
- */
- public boolean hasDifferentChildren(TreePath path) {
- return pathHasChildrenWithValue(path, !isPathChecked(path));
- }
-
- /**
- * Update the grayness value of the parents of path. Note: the greyness
- * and checking of the other nodes (not ancestors) MUST BE consistent.
- *
- * @param path the treepath containing the ancestors to be grey-updated
- */
- public void updateAncestorsGreyness(TreePath path) {
- TreePath[] parents = new TreePath[path.getPathCount()];
- parents[0] = path;
- boolean greyAll = isPathGreyed(path);
- for (int i = 1; i < parents.length; i++) {
- parents[i] = parents[i - 1].getParentPath();
- if (greyAll) {
- addToGreyedPathsSet(parents[i]);
- } else {
- updatePathGreyness(parents[i]);
- greyAll = isPathGreyed(parents[i]);
- }
- }
- }
-
- /**
- * Return the paths that are children of path, using methods of
- * TreeModel. Nodes don't have to be of type TreeNode.
- *
- * @param path the parent path
- * @return the array of children path
- */
- protected TreePath[] getChildrenPath(TreePath path) {
- Object node = path.getLastPathComponent();
- int childrenNumber = this.model.getChildCount(node);
- TreePath[] childrenPath = new TreePath[childrenNumber];
- for (int childIndex = 0; childIndex < childrenNumber; childIndex++) {
- childrenPath[childIndex] = path.pathByAddingChild(this.model.getChild(node, childIndex));
- }
- return childrenPath;
- }
-
- public TreeModel getTreeModel() {
- return this.model;
- }
-
- /**
- * Sets the specified tree model. The current cheking is cleared.
- */
- public void setTreeModel(TreeModel newModel) {
- TreeModel oldModel = this.model;
- if (oldModel != null) {
- oldModel.removeTreeModelListener(this.propagateCheckingListener);
- }
- this.model = newModel;
- if (newModel != null) {
- newModel.addTreeModelListener(this.propagateCheckingListener);
- }
- clearChecking();
- }
-
- /**
- * Return a string that describes the tree model including the values of
- * checking, enabling, greying.
- */
- @Override
- public String toString() {
- return toString(new TreePath(this.model.getRoot()));
- }
-
- /**
- * Convenience method for getting a string that describes the tree
- * starting at path.
- *
- * @param path the treepath root of the tree
- */
- private String toString(TreePath path) {
- String checkString = "n";
- String greyString = "n";
- String enableString = "n";
- if (isPathChecked(path)) {
- checkString = "y";
- }
- if (isPathEnabled(path)) {
- enableString = "y";
- }
- if (isPathGreyed(path)) {
- greyString = "y";
- }
- String description = "Path checked: " + checkString + " greyed: " + greyString + " enabled: " + enableString + " Name: "
- + path.toString() + "\n";
- for (TreePath childPath : getChildrenPath(path)) {
- description += toString(childPath);
- }
- return description;
- }
-
-}
diff --git a/tools/src/it/cnr/imaa/essi/lablib/gui/checkboxtree/PropagatePreservingCheckTreeCheckingMode.java b/tools/src/it/cnr/imaa/essi/lablib/gui/checkboxtree/PropagatePreservingCheckTreeCheckingMode.java
deleted file mode 100644
index 5984899077..0000000000
--- a/tools/src/it/cnr/imaa/essi/lablib/gui/checkboxtree/PropagatePreservingCheckTreeCheckingMode.java
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- * Copyright 2006,2007 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 it.cnr.imaa.essi.lablib.gui.checkboxtree;
-
-import javax.swing.tree.TreePath;
-
-/**
- * PropagatePreservingCheckTreeCheckingMode define a TreeCheckingMode with down
- * and up recursion of the check when nodes are clicked. It propagates the change
- * not only to descendants but also to ancestors. With regard to descendants
- * this mode behaves exactly like the Propagate mode. With regard to ancestors
- * it checks/unchecks them as needed so that a node is checked if and only if
- * all of its children are checked.
- *
- * @author Boldrini
- */
-public class PropagatePreservingCheckTreeCheckingMode extends TreeCheckingMode {
-
- PropagatePreservingCheckTreeCheckingMode(DefaultTreeCheckingModel model) {
- super(model);
- }
-
- @Override
- public void checkPath(TreePath path) {
- // check is propagated to children
- this.model.checkSubTree(path);
- // check all the ancestors with subtrees checked
- TreePath[] parents = new TreePath[path.getPathCount()];
- parents[0] = path;
- boolean uncheckAll = false;
- boolean greyAll = false;
- for (int i = 1; i < parents.length; i++) {
- parents[i] = parents[i - 1].getParentPath();
- if (uncheckAll) {
- this.model.removeFromCheckedPathsSet(parents[i]);
- if (greyAll) {
- this.model.addToGreyedPathsSet(parents[i]);
- } else {
- if (this.model.pathHasUncheckedChildren(parents[i])) {
- this.model.addToGreyedPathsSet(parents[i]);
- greyAll = true;
- } else {
- this.model.removeFromGreyedPathsSet(parents[i]);
- }
- }
- } else {
- switch (this.model.getChildrenChecking(parents[i])) {
- case HALF_CHECKED:
- this.model.removeFromCheckedPathsSet(parents[i]);
- this.model.addToGreyedPathsSet(parents[i]);
- uncheckAll = true;
- greyAll = true;
- break;
- case ALL_UNCHECKED:
- this.model.removeFromCheckedPathsSet(parents[i]);
- this.model.removeFromGreyedPathsSet(parents[i]);
- uncheckAll = true;
- break;
- case ALL_CHECKED:
- this.model.addToCheckedPathsSet(parents[i]);
- this.model.removeFromGreyedPathsSet(parents[i]);
- break;
- default:
- case NO_CHILDREN:
- System.err.println("This should not happen (PropagatePreservingCheckTreeCheckingMode)");
- break;
- }
- }
- }
- }
-
- @Override
- public void uncheckPath(TreePath path) {
- // uncheck is propagated to children
- this.model.uncheckSubTree(path);
- TreePath parentPath = path;
- // uncheck is propagated to parents, too
- while ((parentPath = parentPath.getParentPath()) != null) {
- this.model.removeFromCheckedPathsSet(parentPath);
- this.model.updatePathGreyness(parentPath);
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see it.cnr.imaa.essi.lablib.gui.checkboxtree.TreeCheckingMode#updateCheckAfterChildrenInserted(javax.swing.tree.TreePath)
- */
- @Override
- public void updateCheckAfterChildrenInserted(TreePath parent) {
- if (this.model.isPathChecked(parent)) {
- checkPath(parent);
- } else {
- uncheckPath(parent);
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see it.cnr.imaa.essi.lablib.gui.checkboxtree.TreeCheckingMode#updateCheckAfterChildrenRemoved(javax.swing.tree.TreePath)
- */
- @Override
- public void updateCheckAfterChildrenRemoved(TreePath parent) {
- if (!this.model.isPathChecked(parent)) {
- // System.out.println(parent +" was removed (not checked)");
- if (this.model.getChildrenPath(parent).length != 0) {
- if (!this.model.pathHasChildrenWithValue(parent, false)) {
- // System.out.println("uncheking it");
- checkPath(parent);
- }
- }
- }
- this.model.updatePathGreyness(parent);
- this.model.updateAncestorsGreyness(parent);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see it.cnr.imaa.essi.lablib.gui.checkboxtree.TreeCheckingMode#updateCheckAfterStructureChanged(javax.swing.tree.TreePath)
- */
- @Override
- public void updateCheckAfterStructureChanged(TreePath parent) {
- if (this.model.isPathChecked(parent)) {
- checkPath(parent);
- } else {
- uncheckPath(parent);
- }
- }
-
-}
\ No newline at end of file
diff --git a/tools/src/it/cnr/imaa/essi/lablib/gui/checkboxtree/PropagatePreservingUncheckTreeCheckingMode.java b/tools/src/it/cnr/imaa/essi/lablib/gui/checkboxtree/PropagatePreservingUncheckTreeCheckingMode.java
deleted file mode 100644
index 058249c093..0000000000
--- a/tools/src/it/cnr/imaa/essi/lablib/gui/checkboxtree/PropagatePreservingUncheckTreeCheckingMode.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * Copyright 2006,2007 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 it.cnr.imaa.essi.lablib.gui.checkboxtree;
-
-import javax.swing.tree.TreePath;
-
-/**
- * PropagatePreservingUncheckTreeCheckingMode define a TreeCheckingMode with
- * down and up recursion of the check when nodes are clicked. It propagates the
- * change not only to descendants but also to ancestors. With regard to
- * descendants this mode behaves exactly like the Propagate mode. With regard to
- * ancestors it checks/unchecks them as needed so that a node is unchecked if
- * and only if all of its children are unchecked.
- *
- * @author Boldrini
- */
-public class PropagatePreservingUncheckTreeCheckingMode extends TreeCheckingMode {
-
- PropagatePreservingUncheckTreeCheckingMode(DefaultTreeCheckingModel model) {
- super(model);
- }
-
- @Override
- public void checkPath(TreePath path) {
- // check is propagated to children
- this.model.checkSubTree(path);
- // check all the ancestors with subtrees checked
- TreePath[] parents = new TreePath[path.getPathCount()];
- parents[0] = path;
- // boolean uncheckAll = false;
- boolean greyAll = false;
- for (int i = 1; i < parents.length; i++) {
- parents[i] = parents[i - 1].getParentPath();
- this.model.addToCheckedPathsSet(parents[i]);
- if (greyAll) {
- this.model.addToGreyedPathsSet(parents[i]);
- } else {
- switch (this.model.getChildrenChecking(parents[i])) {
- case HALF_CHECKED:
- this.model.addToGreyedPathsSet(parents[i]);
- greyAll = true;
- break;
- case ALL_UNCHECKED:
- System.err.println("This should not happen (PropagatePreservingUncheckTreeCheckingMode)");
- break;
- case ALL_CHECKED:
- this.model.removeFromGreyedPathsSet(parents[i]);
- break;
- default:
- case NO_CHILDREN:
- System.err.println("This should not happen (PropagatePreservingCheckTreeCheckingMode)");
- break;
- }
- }
- }
- }
-
- @Override
- public void uncheckPath(TreePath path) {
- // uncheck is propagated to children
- this.model.uncheckSubTree(path);
- TreePath parentPath = path;
- // check all the ancestors with subtrees checked
- while ((parentPath = parentPath.getParentPath()) != null) {
- switch (this.model.getChildrenChecking(parentPath)) {
- case HALF_CHECKED:
- this.model.addToCheckedPathsSet(parentPath);
- this.model.addToGreyedPathsSet(parentPath);
- break;
- case ALL_UNCHECKED:
- this.model.removeFromCheckedPathsSet(parentPath);
- this.model.removeFromGreyedPathsSet(parentPath);
- break;
- case ALL_CHECKED:
- System.err.println("This should not happen (PropagatePreservingUncheckTreeCheckingMode)");
- break;
- default:
- case NO_CHILDREN:
- System.err.println("This should not happen (PropagatePreservingCheckTreeCheckingMode)");
- break;
- }
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see it.cnr.imaa.essi.lablib.gui.checkboxtree.TreeCheckingMode#updateCheckAfterChildrenInserted(javax.swing.tree.TreePath)
- */
- @Override
- public void updateCheckAfterChildrenInserted(TreePath parent) {
- if (this.model.isPathChecked(parent)) {
- this.model.checkSubTree(parent);
- } else {
- this.model.uncheckSubTree(parent);
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see it.cnr.imaa.essi.lablib.gui.checkboxtree.TreeCheckingMode#updateCheckAfterChildrenRemoved(javax.swing.tree.TreePath)
- */
- @Override
- public void updateCheckAfterChildrenRemoved(TreePath parent) {
- if (this.model.isPathChecked(parent)) {
- // System.out.println(parent +" was removed (not checked)");
- if (this.model.getChildrenPath(parent).length != 0) {
- if (!this.model.pathHasChildrenWithValue(parent, true)) {
- // System.out.println("uncheking it");
- uncheckPath(parent);
- }
- }
- }
- this.model.updatePathGreyness(parent);
- this.model.updateAncestorsGreyness(parent);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see it.cnr.imaa.essi.lablib.gui.checkboxtree.TreeCheckingMode#updateCheckAfterStructureChanged(javax.swing.tree.TreePath)
- */
- @Override
- public void updateCheckAfterStructureChanged(TreePath parent) {
- if (this.model.isPathChecked(parent)) {
- checkPath(parent);
- } else {
- uncheckPath(parent);
- }
- }
-
-}
\ No newline at end of file
diff --git a/tools/src/it/cnr/imaa/essi/lablib/gui/checkboxtree/PropagateTreeCheckingMode.java b/tools/src/it/cnr/imaa/essi/lablib/gui/checkboxtree/PropagateTreeCheckingMode.java
deleted file mode 100644
index fe1a502963..0000000000
--- a/tools/src/it/cnr/imaa/essi/lablib/gui/checkboxtree/PropagateTreeCheckingMode.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Copyright 2006,2007 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 it.cnr.imaa.essi.lablib.gui.checkboxtree;
-
-import javax.swing.tree.TreePath;
-
-/**
- * PropagateTreeCheckingMode define a TreeCheckingMode with down recursion of
- * the check when nodes are clicked. It toggles the just-clicked checkbox and
- * propagates the change down. In other words, if the clicked checkbox is
- * checked all the descendants will be checked; otherwise all the descendants
- * will be unchecked.
- *
- * @author Boldrini
- */
-public class PropagateTreeCheckingMode extends TreeCheckingMode {
-
- PropagateTreeCheckingMode(DefaultTreeCheckingModel model) {
- super(model);
- }
-
- @Override
- public void checkPath(TreePath path) {
- this.model.checkSubTree(path);
- this.model.updatePathGreyness(path);
- this.model.updateAncestorsGreyness(path);
- }
-
- @Override
- public void uncheckPath(TreePath path) {
- this.model.uncheckSubTree(path);
- this.model.updatePathGreyness(path);
- this.model.updateAncestorsGreyness(path);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see it.cnr.imaa.essi.lablib.gui.checkboxtree.TreeCheckingMode#updateCheckAfterChildrenInserted(javax.swing.tree.TreePath)
- */
- @Override
- public void updateCheckAfterChildrenInserted(TreePath parent) {
- if (this.model.isPathChecked(parent)) {
- this.model.checkSubTree(parent);
- } else {
- this.model.uncheckSubTree(parent);
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see it.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)
- *
- * @see it.cnr.imaa.essi.lablib.gui.checkboxtree.TreeCheckingMode#updateCheckAfterStructureChanged(javax.swing.tree.TreePath)
- */
- @Override
- public void updateCheckAfterStructureChanged(TreePath parent) {
- if (this.model.isPathChecked(parent)) {
- this.model.checkSubTree(parent);
- } else {
- this.model.uncheckSubTree(parent);
- }
- }
-
-}
\ No newline at end of file
diff --git a/tools/src/it/cnr/imaa/essi/lablib/gui/checkboxtree/PropagateUpWhiteTreeCheckingMode.java b/tools/src/it/cnr/imaa/essi/lablib/gui/checkboxtree/PropagateUpWhiteTreeCheckingMode.java
deleted file mode 100644
index eac35db343..0000000000
--- a/tools/src/it/cnr/imaa/essi/lablib/gui/checkboxtree/PropagateUpWhiteTreeCheckingMode.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Copyright 2006,2007 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 it.cnr.imaa.essi.lablib.gui.checkboxtree;
-
-import javax.swing.tree.TreePath;
-
-/**
- * PropagateUpWhiteTreeCheckingMode define a TreeCheckingMode with down
- * recursion of the check when nodes are clicked and up only when uncheck. The
- * check is propagated, like the Propagate mode to descendants. If a user
- * unchecks a checkbox the uncheck will also be propagated to ancestors.
- *
- * @author Boldrini
- */
-public class PropagateUpWhiteTreeCheckingMode extends TreeCheckingMode {
-
- PropagateUpWhiteTreeCheckingMode(DefaultTreeCheckingModel model) {
- super(model);
- }
-
- @Override
- public void checkPath(TreePath path) {
- // check is propagated to children
- this.model.checkSubTree(path);
- // check all the ancestors with subtrees checked
- TreePath[] parents = new TreePath[path.getPathCount()];
- parents[0] = path;
- TreePath parentPath = path;
- // uncheck is propagated to parents, too
- while ((parentPath = parentPath.getParentPath()) != null) {
- this.model.updatePathGreyness(parentPath);
- }
- }
-
- @Override
- public void uncheckPath(TreePath path) {
- // uncheck is propagated to children
- this.model.uncheckSubTree(path);
- TreePath parentPath = path;
- // uncheck is propagated to parents, too
- while ((parentPath = parentPath.getParentPath()) != null) {
- this.model.removeFromCheckedPathsSet(parentPath);
- this.model.updatePathGreyness(parentPath);
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see it.cnr.imaa.essi.lablib.gui.checkboxtree.TreeCheckingMode#updateCheckAfterChildrenInserted(javax.swing.tree.TreePath)
- */
- @Override
- public void updateCheckAfterChildrenInserted(TreePath parent) {
- if (this.model.isPathChecked(parent)) {
- checkPath(parent);
- } else {
- uncheckPath(parent);
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see it.cnr.imaa.essi.lablib.gui.checkboxtree.TreeCheckingMode#updateCheckAfterChildrenRemoved(javax.swing.tree.TreePath)
- */
- @Override
- public void updateCheckAfterChildrenRemoved(TreePath parent) {
- if (!this.model.isPathChecked(parent)) {
- // System.out.println(parent +" was removed (not checked)");
- if (this.model.getChildrenPath(parent).length != 0) {
- if (!this.model.pathHasChildrenWithValue(parent, false)) {
- // System.out.println("uncheking it");
- checkPath(parent);
- }
- }
- }
- this.model.updatePathGreyness(parent);
- this.model.updateAncestorsGreyness(parent);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see it.cnr.imaa.essi.lablib.gui.checkboxtree.TreeCheckingMode#updateCheckAfterStructureChanged(javax.swing.tree.TreePath)
- */
- @Override
- public void updateCheckAfterStructureChanged(TreePath parent) {
- if (this.model.isPathChecked(parent)) {
- checkPath(parent);
- } else {
- uncheckPath(parent);
- }
- }
-
-}
\ No newline at end of file
diff --git a/tools/src/it/cnr/imaa/essi/lablib/gui/checkboxtree/QuadristateButtonModel.java b/tools/src/it/cnr/imaa/essi/lablib/gui/checkboxtree/QuadristateButtonModel.java
deleted file mode 100644
index a0efacf229..0000000000
--- a/tools/src/it/cnr/imaa/essi/lablib/gui/checkboxtree/QuadristateButtonModel.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * Copyright 2006,2007 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 it.cnr.imaa.essi.lablib.gui.checkboxtree;
-
-import javax.swing.DefaultButtonModel;
-
-/**
- * The model for a quadristate CheckBox. Available states are UNCHECKED,
- * CHECKED, GREY_CHECKED, GREY_UNCHECKED
- *
- * @author boldrini
- */
-public class QuadristateButtonModel extends DefaultButtonModel {
-
- public enum State {
- UNCHECKED, CHECKED, GREY_CHECKED, GREY_UNCHECKED
- }
-
- public QuadristateButtonModel() {
- super();
- setState(State.UNCHECKED);
- }
-
- /** Filter: No one may change the armed status except us. */
- @Override
- public void setArmed(boolean b) {
- }
-
- // public void setSelected(boolean b) {
- // if (b) {
- // setState(State.CHECKED);
- // } else {
- // setState(State.UNCHECKED);
- // }
- // }
-
- public void setState(State state) {
- switch (state) {
- case UNCHECKED:
- super.setArmed(false);
- setPressed(false);
- setSelected(false);
- break;
- case CHECKED:
- super.setArmed(false);
- setPressed(false);
- setSelected(true);
- break;
- case GREY_UNCHECKED:
- super.setArmed(true);
- setPressed(true);
- setSelected(false);
- break;
- case GREY_CHECKED:
- super.setArmed(true);
- setPressed(true);
- setSelected(true);
- break;
- }
- }
-
- /**
- * The current state is embedded in the selection / armed state of the
- * model. We return the CHECKED state when the checkbox is selected but
- * not armed, GREY_CHECKED state when the checkbox is selected and armed
- * (grey) and UNCHECKED when the checkbox is deselected.
- */
- public State getState() {
- if (isSelected() && !isArmed()) {
- // CHECKED
- return State.CHECKED;
- } else if (isSelected() && isArmed()) {
- // GREY_CHECKED
- return State.GREY_CHECKED;
- } else if (!isSelected() && isArmed()) {
- // GREY_UNCHECKED
- return State.GREY_UNCHECKED;
- } else { // (!isSelected() && !isArmed()){
- // UNCHECKED
- return State.UNCHECKED;
- }
- }
-
- /**
- * We rotate between UNCHECKED, CHECKED, GREY_UNCHECKED, GREY_CHECKED.
- */
- public void nextState() {
- switch (getState()) {
- case UNCHECKED:
- setState(State.CHECKED);
- break;
- case CHECKED:
- setState(State.GREY_UNCHECKED);
- break;
- case GREY_UNCHECKED:
- setState(State.GREY_CHECKED);
- break;
- case GREY_CHECKED:
- setState(State.UNCHECKED);
- break;
- }
- }
-}
diff --git a/tools/src/it/cnr/imaa/essi/lablib/gui/checkboxtree/QuadristateCheckbox.java b/tools/src/it/cnr/imaa/essi/lablib/gui/checkboxtree/QuadristateCheckbox.java
deleted file mode 100644
index 87496652ee..0000000000
--- a/tools/src/it/cnr/imaa/essi/lablib/gui/checkboxtree/QuadristateCheckbox.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * Copyright 2006,2007 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 it.cnr.imaa.essi.lablib.gui.checkboxtree;
-
-import it.cnr.imaa.essi.lablib.gui.checkboxtree.QuadristateButtonModel.State;
-
-import java.awt.event.ActionEvent;
-import java.awt.event.MouseAdapter;
-import java.awt.event.MouseEvent;
-import java.awt.event.MouseListener;
-
-import javax.swing.AbstractAction;
-import javax.swing.ActionMap;
-import javax.swing.ButtonModel;
-import javax.swing.Icon;
-import javax.swing.JCheckBox;
-import javax.swing.SwingUtilities;
-import javax.swing.plaf.ActionMapUIResource;
-
-/**
- * Checkbox with four states. Available states are UNCHECKED, CHECKED,
- * GREY_CHECKED, GREY_UNCHECKED. The rendering is obtained via a visualization
- * hack. The checkbox exploits the different rendering (greyed) of checkbox
- * pressed, thus the press, arm, rollover events are not available. Maintenance
- * tip - There were some tricks to getting this code working: 1. You have to
- * overwite addMouseListener() to do nothing 2. You have to add a mouse event on
- * mousePressed by calling super.addMouseListener() 3. You have to replace the
- * UIActionMap for the keyboard event "pressed" with your own one. 4. You have
- * to remove the UIActionMap for the keyboard event "released". 5. You have to
- * grab focus when the next state is entered, otherwise clicking on the
- * component won't get the focus.
- *
- * @author boldrini
- * @author bigagli
- */
-
-public class QuadristateCheckbox extends JCheckBox {
-
- public QuadristateCheckbox(String text, Icon icon, State state) {
- super(text, icon);
- // Add a listener for when the mouse is pressed
- super.addMouseListener(new MouseAdapter() {
- @Override
- public void mousePressed(MouseEvent e) {
- grabFocus();
- getModel().nextState();
- }
- });
- // Reset the keyboard action map
- ActionMap map = new ActionMapUIResource();
- map.put("pressed", new AbstractAction() {
- public void actionPerformed(ActionEvent e) {
- grabFocus();
- getModel().nextState();
- }
- });
- map.put("released", null);
- SwingUtilities.replaceUIActionMap(this, map);
- setState(state);
- }
-
- public QuadristateCheckbox(String text, State initial) {
- this(text, null, initial);
- }
-
- public QuadristateCheckbox(String text) {
- this(text, State.UNCHECKED);
- }
-
- public QuadristateCheckbox() {
- this(null);
- }
-
- @Override
- protected void init(String text, Icon icon) {
- // substitutes the underlying checkbox model:
- // if we had call setModel an exception would be raised
- // because setModel calls a getModel that return a
- // QuadristateButtonModel, but at this point we
- // have a JToggleButtonModel
- this.model = new QuadristateButtonModel();
- super.setModel(this.model); // side effect: set listeners
- super.init(text, icon);
- }
-
- @Override
- public QuadristateButtonModel getModel() {
- return (QuadristateButtonModel) super.getModel();
- }
-
- public void setModel(QuadristateButtonModel model) {
- super.setModel(model);
- }
-
- @Override
- @Deprecated
- public void setModel(ButtonModel model) {
- // if (!(model instanceof TristateButtonModel))
- // useless: Java always calls the most specific method
- super.setModel(model);
- }
-
- /** No one may add mouse listeners, not even Swing! */
- @Override
- public void addMouseListener(MouseListener l) {
- }
-
- /**
- * Set the new state to either CHECKED, UNCHECKED or GREY_CHECKED. If
- * state == null, it is treated as GREY_CHECKED.
- */
- public void setState(State state) {
- getModel().setState(state);
- }
-
- /**
- * Return the current state, which is determined by the selection status
- * of the model.
- */
- public State getState() {
- return getModel().getState();
- }
-
-}
diff --git a/tools/src/it/cnr/imaa/essi/lablib/gui/checkboxtree/SimpleTreeCheckingMode.java b/tools/src/it/cnr/imaa/essi/lablib/gui/checkboxtree/SimpleTreeCheckingMode.java
deleted file mode 100644
index 05af10677b..0000000000
--- a/tools/src/it/cnr/imaa/essi/lablib/gui/checkboxtree/SimpleTreeCheckingMode.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright 2006,2007 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 it.cnr.imaa.essi.lablib.gui.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 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)
- *
- * @see it.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)
- *
- * @see it.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)
- *
- * @see it.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);
- }
-
-}
\ No newline at end of file
diff --git a/tools/src/it/cnr/imaa/essi/lablib/gui/checkboxtree/TreeCheckingEvent.java b/tools/src/it/cnr/imaa/essi/lablib/gui/checkboxtree/TreeCheckingEvent.java
deleted file mode 100644
index b6130c146f..0000000000
--- a/tools/src/it/cnr/imaa/essi/lablib/gui/checkboxtree/TreeCheckingEvent.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright 2006,2007 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 it.cnr.imaa.essi.lablib.gui.checkboxtree;
-
-import java.util.EventObject;
-
-import javax.swing.tree.TreePath;
-
-/**
- * An event that characterizes a change in the current checking.
- *
- * @author boldrini
- */
-public class TreeCheckingEvent extends EventObject {
- /** Paths this event represents. */
- protected TreePath leadingPath;
-
- /**
- * Returns the paths that have been added or removed from the selection.
- */
- public TreePath getLeadingPath() {
- return this.leadingPath;
- }
-
- public TreeCheckingEvent(TreePath path) {
- super(path);
- this.leadingPath = path;
- }
-
-}
diff --git a/tools/src/it/cnr/imaa/essi/lablib/gui/checkboxtree/TreeCheckingListener.java b/tools/src/it/cnr/imaa/essi/lablib/gui/checkboxtree/TreeCheckingListener.java
deleted file mode 100644
index c24f466823..0000000000
--- a/tools/src/it/cnr/imaa/essi/lablib/gui/checkboxtree/TreeCheckingListener.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright 2006,2007 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 it.cnr.imaa.essi.lablib.gui.checkboxtree;
-
-import java.util.EventListener;
-
-/**
- * The listener that's notified when the checking in a TreeCheckingModel
- * changes.
- *
- * @see it.cnr.imaa.essi.lablib.gui.checkboxtree.TreeCheckingModel
- * @see it.cnr.imaa.essi.lablib.gui.checkboxtree.CheckboxTree
- * @author Enrico Boldrini
- */
-public interface TreeCheckingListener extends EventListener {
- /**
- * Called whenever the value of the checking changes.
- *
- * @param e the event that characterizes the change.
- */
- void valueChanged(TreeCheckingEvent e);
-}
\ No newline at end of file
diff --git a/tools/src/it/cnr/imaa/essi/lablib/gui/checkboxtree/TreeCheckingMode.java b/tools/src/it/cnr/imaa/essi/lablib/gui/checkboxtree/TreeCheckingMode.java
deleted file mode 100644
index 4cb6915dc6..0000000000
--- a/tools/src/it/cnr/imaa/essi/lablib/gui/checkboxtree/TreeCheckingMode.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright 2006,2007 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 it.cnr.imaa.essi.lablib.gui.checkboxtree;
-
-import javax.swing.tree.TreePath;
-
-/**
- * The model for checking/unchecking the nodes of a CheckboxTree. Alterations
- * of a node state may propagate on descendants/ascendants, according to the
- * behaviour of the model. Several default behavioural modes are defined. The
- * models must use the methods addToCheckedSet and removeFromCheckedSet from
- * DefaultTreeCheckingModel to add/remove the single paths from the checking
- * set.
- *
- * @author bigagli
- * @author boldrini
- */
-public abstract class TreeCheckingMode {
-
- protected DefaultTreeCheckingModel model;
-
- // TODO: implementare Strategy in questo modo: TreeCheckingMode classe
- // interna al TreeCheckingModel, con un metodo getModel() protetto,
- // utile
- // alle sottoclassi
- TreeCheckingMode(DefaultTreeCheckingModel model) {
- this.model = model;
- }
-
- /**
- * Checks the specified path and propagates the checking according to
- * the strategy
- *
- * @param path the path to be added.
- */
-
- public abstract void checkPath(TreePath path);
-
- /**
- * Unchecks the specified path and propagates the checking according to
- * the strategy
- *
- * @param path the path to be removed.
- */
- public abstract void uncheckPath(TreePath path);
-
- /**
- * Update the check of the given path after the insertion of some of its
- * children, according to the strategy
- *
- * @param path
- */
- public abstract void updateCheckAfterChildrenInserted(TreePath path);
-
- /**
- * Update the check of the given path after the removal of some of its
- * children, according to the strategy
- *
- * @param path
- */
- public abstract void updateCheckAfterChildrenRemoved(TreePath path);
-
- /**
- * Update the check of the given path after the structure change,
- * according to the strategy
- *
- * @param path
- */
- public abstract void updateCheckAfterStructureChanged(TreePath path);
-
-}
diff --git a/tools/src/it/cnr/imaa/essi/lablib/gui/checkboxtree/TreeCheckingModel.java b/tools/src/it/cnr/imaa/essi/lablib/gui/checkboxtree/TreeCheckingModel.java
deleted file mode 100644
index 0b2e0d9806..0000000000
--- a/tools/src/it/cnr/imaa/essi/lablib/gui/checkboxtree/TreeCheckingModel.java
+++ /dev/null
@@ -1,223 +0,0 @@
-/*
- * Copyright 2006,2007 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 it.cnr.imaa.essi.lablib.gui.checkboxtree;
-
-import javax.swing.event.TreeModelListener;
-import javax.swing.tree.TreeModel;
-import javax.swing.tree.TreePath;
-
-/**
- * The model for checking/unchecking the nodes of a CheckboxTree. Alterations of
- * a node state may propagate on descendants/ascendants, according to the
- * behaviour of the checking model. See CheckingMode for the available
- * behaviours.
- *
- * @author bigagli
- * @author boldrini
- */
-public interface TreeCheckingModel {
-
- /**
- * The checking behaviours provided by this class.
- *
- * @author boldrini
- */
- public enum CheckingMode {
-
- /**
- * The check is not propagated at all, toggles the just-clicked checkbox
- * only.
- */
- SIMPLE,
-
- /**
- * Toggles the just-clicked checkbox and propagates the change down. In
- * other words, if the clicked checkbox is checked all the descendants
- * will be checked; otherwise all the descendants will be unchecked
- */
- PROPAGATE,
-
- /**
- * The check is propagated, like the Propagate mode to descendants. If a
- * user unchecks a checkbox the uncheck will also be propagated to
- * ancestors.
- */
- PROPAGATE_UP_UNCHECK,
-
- /**
- * Propagates the change not only to descendants but also to ancestors.
- * With regard to descendants this mode behaves exactly like the
- * Propagate mode. With regard to ancestors it checks/unchecks them as
- * needed so that a node is unchecked if and only if all of its children
- * are unchecked.
- */
- PROPAGATE_PRESERVING_UNCHECK,
-
- /**
- * Propagates the change not only to descendants but also to ancestors.
- * With regard to descendants this mode behaves exactly like the
- * Propagate mode. With regard to ancestors it checks/unchecks them as
- * needed so that a node is checked if and only if all of its children
- * are checked.
- */
- PROPAGATE_PRESERVING_CHECK
- }
-
- /**
- * Returns whether the specified path is checked.
- */
- public boolean isPathChecked(TreePath path);
-
- /**
- * Returns whether the specified path checking state can be toggled.
- */
- public boolean isPathCheckBox(TreePath path);
- public boolean isPathEnabled(TreePath path);
-
- /**
- * Returns whether the specified path is greyed.
- */
- public boolean isPathGreyed(TreePath path);
-
- /**
- * Alter (check/uncheck) the checking state of the specified path if
- * possible and also propagate the new state if needed by the mode.
- */
- public void toggleCheckingPath(TreePath pathForRow);
-
- /**
- * add a path to the checked paths set
- *
- * @param path the path to be added.
- */
- public void addCheckingPath(TreePath path);
-
- /**
- * add paths to the checked paths set
- *
- * @param paths the paths to be added.
- */
- public void addCheckingPaths(TreePath[] paths);
-
- /**
- * remove a path from the checked paths set
- *
- * @param path the path to be added.
- */
- public void removeCheckingPath(TreePath path);
-
- /**
- * remove paths from the checked paths set
- *
- * @param paths the paths to be added.
- */
- public void removeCheckingPaths(TreePath[] paths);
-
- /**
- * Sets whether or not the path is enabled.
- *
- * @param path the path to enable/disable
- */
- public void setPathEnabled(TreePath path, boolean enable);
-
- /**
- * Sets whether or not the paths are enabled.
- *
- * @param paths the paths to enable/disable
- */
- public void setPathsEnabled(TreePath[] paths, boolean enable);
-
- /**
- * @return Returns the paths that are in the checking set.
- */
- public TreePath[] getCheckingPaths();
-
- /**
- * @return Returns the paths that are in the checking set and are the
- * (upper) roots of checked trees.
- */
- public TreePath[] getCheckingRoots();
-
- /**
- * @return Returns the paths that are in the greying set.
- */
- public TreePath[] getGreyingPaths();
-
- /**
- * Set the checking to paths.
- */
- public void setCheckingPaths(TreePath[] paths);
-
- /**
- * Set the checking to path.
- */
- public void setCheckingPath(TreePath path);
-
- /**
- * Clears the checking.
- */
- public void clearChecking();
-
- /**
- * Set the checking mode.
- *
- * @param mode The checkingMode to set.
- */
- public void setCheckingMode(CheckingMode mode);
-
- /**
- * @return Returns the CheckingMode.
- */
- public CheckingMode getCheckingMode();
-
- /**
- * Get the listener for the TreeModelEvent
posted after
- * the tree changes.
- *
- * @deprecated use get/setTreeModel instead
- */
- @Deprecated
- public TreeModelListener getTreeModelListener();
-
- /**
- * Adds x to the list of listeners that are notified each time the set
- * of checking TreePaths changes.
- *
- * @param x the new listener to be added
- */
- public void addTreeCheckingListener(TreeCheckingListener x);
-
- /**
- * Removes x from the list of listeners that are notified each time the
- * set of checking TreePaths changes.
- *
- * @param x the listener to remove
- */
- public void removeTreeCheckingListener(TreeCheckingListener x);
-
- /**
- * Returns the tree model to which this checking model is bound, or null
- * if not set.
- */
- public TreeModel getTreeModel();
-
- /**
- * Set the tree model to which this checking model is (possibly) bound.
- * A checking model may use a tree model to propagate the checking. A
- * checking model may also listen to the model, to adjust the checking
- * upon model events. The current checking is cleared.
- */
- public void setTreeModel(TreeModel model);
-
-}