fiore@3: /*
fiore@3: CCmI Editor - A Collaborative Cross-Modal Diagram Editing Tool
fiore@3:
fiore@3: Copyright (C) 2011 Queen Mary University of London (http://ccmi.eecs.qmul.ac.uk/)
fiore@3:
fiore@3: This program is free software: you can redistribute it and/or modify
fiore@3: it under the terms of the GNU General Public License as published by
fiore@3: the Free Software Foundation, either version 3 of the License, or
fiore@3: (at your option) any later version.
fiore@3:
fiore@3: This program is distributed in the hope that it will be useful,
fiore@3: but WITHOUT ANY WARRANTY; without even the implied warranty of
fiore@3: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
fiore@3: GNU General Public License for more details.
fiore@3:
fiore@3: You should have received a copy of the GNU General Public License
fiore@3: along with this program. If not, see .
fiore@3: */
fiore@3: package uk.ac.qmul.eecs.ccmi.checkboxtree;
fiore@3:
fiore@3: import java.util.Stack;
fiore@3:
fiore@3: import javax.swing.tree.DefaultTreeModel;
fiore@3:
fiore@3: import org.xml.sax.Attributes;
fiore@3: import org.xml.sax.SAXException;
fiore@3: import org.xml.sax.helpers.DefaultHandler;
fiore@3:
fiore@3: /* Build a tree out of an XML file. The hierarchical structure of the XML file reflects
fiore@3: * the structure of the tree. The XMl file must have the form specified in CheckBoxTree
fiore@3: * class comment.
fiore@3: *
fiore@3: */
fiore@3: class XMLHandler extends DefaultHandler {
fiore@3:
fiore@3: @SuppressWarnings("serial")
fiore@3: public XMLHandler(DefaultTreeModel treeModel, SetProperties properties){
fiore@3: this.properties = properties;
fiore@3: this.treeModel = treeModel;
fiore@3: /* path is used to keep track of the current node's path. If the path is present as a *
fiore@3: * properties entry, then the current node, that has jus been created, will be set as selected */
fiore@3: path = new Stack() {
fiore@3: @Override
fiore@3: public String toString(){
fiore@3: StringBuilder builder = new StringBuilder();
fiore@3: for(int i=0; i path;
fiore@3: /* attributes used in the XML file */
fiore@3: public static final String VALUE_ATTR = "value";
fiore@3: public static final String SELECTABLE_NODE = "selectable";
fiore@3: public static final String UNSELECTABLE_NODE = "selectable";
fiore@3:
fiore@3:
fiore@3: }