Package javax.swing.tree

Examples of javax.swing.tree.DefaultMutableTreeNode$PreorderEnumeration


    public VPFConfig(LibraryBean lb, LayerHandler layerHandler, String layerName) {
        this.layerHandler = layerHandler;
        this.layerName = layerName;

        // Create the nodes.
        DefaultMutableTreeNode top = new DefaultMutableTreeNode("VPF Data Libraries");
        try {
            createNodes(top, lb.getLibrarySelectionTable());
        } catch (FormatException fe) {
            Debug.output("Caught FormatException reading data: "
                    + fe.getMessage());
View Full Code Here


    public VPFConfig(VPFLayer layer) {
        if (layer != null && layer.lst != null) {
            this.layer = layer;
            this.layerName = layer.getName();
            // Create the nodes.
            DefaultMutableTreeNode top = new DefaultMutableTreeNode("VPF Data Libraries");
            try {
                createNodes(top, layer.lst);
            } catch (FormatException fe) {
                Debug.output("Caught FormatException reading data: "
                        + fe.getMessage());
View Full Code Here

        tree.setVisibleRowCount(10);

        // Listen for when the selection changes.
        tree.addTreeSelectionListener(new TreeSelectionListener() {
            public void valueChanged(TreeSelectionEvent e) {
                DefaultMutableTreeNode node = (DefaultMutableTreeNode) tree.getLastSelectedPathComponent();

                if (node == null)
                    return;

                Object nodeInfo = node.getUserObject();
                if (node.isLeaf() && nodeInfo instanceof FeatureInfo) {
                    currentFeature = node;
                    // enable addToLayer button here.
                    addFeatureButton.setEnabled(true);
                } else {
                    // disable addToLayer button here.
View Full Code Here

        oldDrawingAttributes.setTo(drawingAttributes);
    }

    protected void loadCurrentFeatures(Enumeration treeEnum, String featureName, LayerGraphicWarehouseSupport warehouse) {
        while (treeEnum.hasMoreElements()) {
            DefaultMutableTreeNode node = (DefaultMutableTreeNode) treeEnum.nextElement();
            Object obj = node.getUserObject();
            // Debug.output(node.getUserObject().getClass().getName()
            // + ", " + node.getUserObject());
            if (obj instanceof FeatureInfo) {
                FeatureInfo fi = (FeatureInfo) obj;
                if (fi.featureName.equals(featureName)) {
                    currentFeature = node;

                    if (warehouse instanceof VPFFeatureGraphicWarehouse) {
                        FeatureDrawingAttributes fda = ((VPFFeatureGraphicWarehouse) warehouse).getAttributesForFeature(featureName);
                        if (fda != null) {
                            fda.setTo(drawingAttributes);
                        }
                    }

                    actionPerformed(new ActionEvent(this, 0, AddFeatureCmd));
                }
            } else {
                loadCurrentFeatures(node.children(), featureName, warehouse);
            }
        }
    }
View Full Code Here

            if (fcr.type == CoverageTable.SKIP_FEATURETYPE) {
                continue;
            }

            coverageNode.add(new DefaultMutableTreeNode(new FeatureInfo(ct, fcr)));
            numFeatures++;
        }
        return numFeatures > 0;
    }
View Full Code Here

                                  CoverageAttributeTable cat) {
        String[] coverages = cat.getCoverageNames();
        for (int covi = 0; covi < coverages.length; covi++) {
            String coverage = coverages[covi];
            CoverageInfo covInfo = new CoverageInfo(cat, coverage);
            DefaultMutableTreeNode covNode = new DefaultMutableTreeNode(covInfo);
            if (showAll
                    || addFeatureNodes(covNode, cat.getCoverageTable(coverage))
                    || !cat.isTiledData()) {
                libraryNode.add(covNode);
            }
View Full Code Here

    }

    private void createNodes(DefaultMutableTreeNode top,
                             LibrarySelectionTable lst) throws FormatException {

        DefaultMutableTreeNode category = null;

        String[] libraries = lst.getLibraryNames();
        for (int libi = 0; libi < libraries.length; libi++) {
            String library = libraries[libi];
            category = new DefaultMutableTreeNode(library);
            CoverageAttributeTable cat = lst.getCAT(library);
            top.add(category);
            addCoverageNodes(category, cat);
        }
    }
View Full Code Here

        protected Character[] optionChars = new Character[15];
        protected Hashtable optionMenuHashtable;

        public SymbolTreeHolder(SymbolPart schemeSymbolPart, CodeOptions opts) {
            super(schemeSymbolPart);
            DefaultMutableTreeNode top = new DefaultMutableTreeNode(schemeSymbolPart);
            addNodes(top, schemeSymbolPart);

            tree = new JTree(top);
            tree.getSelectionModel()
                    .setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
View Full Code Here

            return tree;
        }

        protected void addNodes(DefaultMutableTreeNode node, SymbolPart sp) {

            DefaultMutableTreeNode newNode = null;
            List subs = sp.getSubs();
            if (subs != null) {
                for (Iterator it = subs.iterator(); it.hasNext();) {
                    sp = (SymbolPart) it.next();
                    newNode = new DefaultMutableTreeNode(sp);
                    node.add(newNode);
                    addNodes(newNode, sp);
                }
            }
        }
View Full Code Here

            }
        }

        public DefaultMutableTreeNode getNodeForCode(String code) {

            DefaultMutableTreeNode root = (DefaultMutableTreeNode) tree.getModel()
                    .getRoot();

            SymbolPart sp = (SymbolPart) root.getUserObject();

            if (Debug.debugging("symbology.detail")) {
                Debug.output("Tree root object has " + sp.getClass().getName()
                        + " user object with code |" + sp.getCode()
                        + "| at code position "
View Full Code Here

TOP

Related Classes of javax.swing.tree.DefaultMutableTreeNode$PreorderEnumeration

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.