Search in sources :

Example 1 with TreeCheckingEvent

use of it.cnr.imaa.essi.lablib.gui.checkboxtree.TreeCheckingEvent in project adempiere by adempiere.

the class RadioButtonTreeCellRenderer method main.

public static void main(String[] args) {
    DefaultMutableTreeNode root = new DefaultMutableTreeNode("root");
    DefaultMutableTreeNode one = new DefaultMutableTreeNode("one");
    DefaultMutableTreeNode two = new DefaultMutableTreeNode("two");
    DefaultMutableTreeNode three = new DefaultMutableTreeNode("three");
    root.add(one);
    root.add(two);
    root.add(three);
    RadioButtonTreeCellRenderer m_RadioButtonTreeCellRenderer = new RadioButtonTreeCellRenderer();
    final CheckboxTree tree = new CheckboxTree(m_RadioButtonTreeCellRenderer.action_loadBOM(null, false));
    tree.getCheckingModel().setCheckingMode(it.cnr.imaa.essi.lablib.gui.checkboxtree.TreeCheckingModel.CheckingMode.SIMPLE);
    tree.getCheckingModel().clearChecking();
    tree.setCellRenderer(m_RadioButtonTreeCellRenderer);
    tree.addTreeCheckingListener(new TreeCheckingListener() {

        public void valueChanged(TreeCheckingEvent e) {
            log.fine("Checked paths changed: user clicked on " + (e.getLeadingPath().getLastPathComponent()));
        //       		TreeModel tm = tree.getModel();
        //          	TreePath selected = tree.getSelectionPath();
        //       		TreeCheckingModel checkingModel = ((CheckboxTree)tree).getCheckingModel();
        }
    });
    JFrame frame = new JFrame("RadioButton tree");
    frame.add(tree);
    tree.expandAll();
    frame.pack();
    frame.setVisible(true);
}
Also used : DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) CheckboxTree(it.cnr.imaa.essi.lablib.gui.checkboxtree.CheckboxTree) JFrame(javax.swing.JFrame) TreeCheckingEvent(it.cnr.imaa.essi.lablib.gui.checkboxtree.TreeCheckingEvent) TreeCheckingListener(it.cnr.imaa.essi.lablib.gui.checkboxtree.TreeCheckingListener)

Aggregations

CheckboxTree (it.cnr.imaa.essi.lablib.gui.checkboxtree.CheckboxTree)1 TreeCheckingEvent (it.cnr.imaa.essi.lablib.gui.checkboxtree.TreeCheckingEvent)1 TreeCheckingListener (it.cnr.imaa.essi.lablib.gui.checkboxtree.TreeCheckingListener)1 JFrame (javax.swing.JFrame)1 DefaultMutableTreeNode (javax.swing.tree.DefaultMutableTreeNode)1