Package javax.swing

Examples of javax.swing.JTree$TreeTimer


    root.add(cwdFilesDir); cwdFilesDir.add(vcwdFilesDir);

    model = new DefaultTreeModel(root);   // a simple tree data model that uses TreeNodes


    GVarsTree = new JTree(model)// JTree displays the set of hierarchical data of model
    GVarsTree.setFont(GlobalValues.guifont);
   
    // single selection
    int mode = TreeSelectionModel.SINGLE_TREE_SELECTION;
    GVarsTree.getSelectionModel().setSelectionMode(mode);
View Full Code Here


            setLayout(new BorderLayout());

            // tree
            final DefaultMutableTreeNode rootNode = new DefaultMutableTreeNode("Groups");
            final JTree groupTree = new JTree(rootNode);

            for (CmisTestGroup group : runner.getGroups()) {
                final TestTreeNode groupNode = new TestTreeNode(groupTree, group);
                rootNode.add(groupNode);
                for (CmisTest test : group.getTests()) {
                    final TestTreeNode testNode = new TestTreeNode(groupTree, test);
                    groupNode.add(testNode);
                }
            }

            ((DefaultTreeModel) groupTree.getModel()).reload();

            groupTree.setRootVisible(false);
            groupTree.setCellRenderer(new TestTreeNodeRender());
            groupTree.setCellEditor(new TestTreeNodeEditor());
            groupTree.setEditable(true);
            ToolTipManager.sharedInstance().registerComponent(groupTree);

            for (int i = 0; i < groupTree.getRowCount(); i++) {
                groupTree.expandRow(i);
            }

            final JPopupMenu treePopup = new JPopupMenu();

            final JMenuItem selectItem = new JMenuItem("Select all");
            selectItem.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    selectAll(groupTree, true);
                }
            });
            treePopup.add(selectItem);

            final JMenuItem deselectItem = new JMenuItem("Deselect all");
            deselectItem.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    selectAll(groupTree, false);
                }
            });
            treePopup.add(deselectItem);

            groupTree.addMouseListener(new MouseAdapter() {
                public void mousePressed(MouseEvent e) {
                    maybeShowPopup(e);
                }

                public void mouseReleased(MouseEvent e) {
View Full Code Here

                browser.setUserObject(new NodeItem(getResource("tree.skins.browser"), getResource("tree.skins.browser.impl")));
                skins.add(browser);
            }
            root.add(skins);
        }
        tree = new JTree(root);
        tree.setRootVisible(false);
        DefaultTreeCellRenderer renderer = new DefaultTreeCellRenderer();
        renderer.setLeafIcon(null);
        renderer.setClosedIcon(null);
        renderer.setOpenIcon(null);
View Full Code Here

         * (non-Javadoc)
         *
         * @see javax.swing.event.TreeSelectionListener#valueChanged(javax.swing.event.TreeSelectionEvent)
         */
        public void valueChanged(TreeSelectionEvent e) {
            final JTree sourceTree = (JTree) e.getSource();
            final DefaultTreeModel treeModel = (DefaultTreeModel) sourceTree
                    .getModel();

            TreePath path = e.getPath();

            if (path == null) { return; }
            final DefaultMutableTreeNode lastPathComponent = (DefaultMutableTreeNode) path
                    .getLastPathComponent();

            // TODO this method will NEVER remove the children and repopulates
            // if the node already has
            // children, be nice to find out
            // whether VFS can help determine whether it should 'relook' for
            // changes or something.

            if (lastPathComponent == null) {
                return;
            } else if (lastPathComponent.getChildCount() > 0) {
                // already determined Children
                return;
            }

            Object userObject = lastPathComponent.getUserObject();
            if (userObject == null || !(userObject instanceof VFSNode)) { return; }
            final VFSNode vfsNode = (VFSNode) userObject;
            Thread thread = new Thread(new Runnable() {

                public void run() {
                    USER_MESSAGE_LOGGER.info("Scanning directory...");
                    sourceTree.setCursor(Cursor
                            .getPredefinedCursor(Cursor.WAIT_CURSOR));
                    lastPathComponent.removeAllChildren();
                    new BackgroundChildFileObjectPopulator(lastPathComponent,
                            vfsNode).run();
                    treeModel.reload(lastPathComponent);
                    sourceTree.setCursor(Cursor.getDefaultCursor());
                }
            });
            thread.setPriority(Thread.MIN_PRIORITY);
            thread.start();
        }
View Full Code Here

        Iterator rootit =pman.topicSpace.topicIterator();
        while(rootit.hasNext()){
            Topic t = (Topic)rootit.next();
            root.add(recurse(t));
        }
        tree = new JTree(root);
//        tree.setRootVisible(true);       
    }
View Full Code Here

         * always needs a root. */
        rootNode = new DefaultMutableTreeNode("POI Filesystems");
        DefaultTreeModel treeModel = new DefaultTreeModel(rootNode);

        /* Create the tree UI element. */
        final JTree treeUI = new JTree(treeModel);
        getContentPane().add(new JScrollPane(treeUI));

        /* Add the POI filesystems to the tree. */
        int displayedFiles = 0;
        for (int i = 0; i < args.length; i++)
        {
            final String filename = args[i];
            try
            {
                POIFSReader r = new POIFSReader();
                r.registerListener(new TreeReaderListener(filename, rootNode));
                r.read(new FileInputStream(filename));
                displayedFiles++;
            }
            catch (IOException ex)
            {
                System.err.println(filename + ": " + ex);
            }
            catch (Throwable t)
            {
                System.err.println("Unexpected exception while reading \"" +
                                   filename + "\":");
                t.printStackTrace(System.err);
            }
        }

        /* Exit if there is no file to display (none specified or only
         * files with problems). */
        if (displayedFiles == 0)
        {
            System.out.println("No POI filesystem(s) to display.");
            System.exit(0);
        }

        /* Make the tree UI element visible. */
        treeUI.setRootVisible(true);
        treeUI.setShowsRootHandles(true);
        ExtendableTreeCellRenderer etcr = new ExtendableTreeCellRenderer();
        etcr.register(DocumentDescriptor.class,
                      new DocumentDescriptorRenderer());
        etcr.register(PropertySetDescriptor.class,
                      new PropertySetDescriptorRenderer());
        treeUI.setCellRenderer(etcr);
        setSize(600, 450);
        setTitle("POI Browser 0.09");
        setVisible(true);
    }
View Full Code Here

        rootSampleResult.setSampleLabel("Root");
        rootSampleResult.setSuccessful(true);
        root = new DefaultMutableTreeNode(rootSampleResult);

        treeModel = new DefaultTreeModel(root);
        jTree = new JTree(treeModel);
        jTree.setCellRenderer(new ResultsNodeRenderer());
        jTree.getSelectionModel().setSelectionMode(
            TreeSelectionModel.SINGLE_TREE_SELECTION);
        jTree.addTreeSelectionListener(this);
        jTree.setShowsRootHandles(true);
View Full Code Here

     *
     * @return             the initialized test tree GUI
     */
    private JTree makeTree(TreeModel treeModel, JMeterTreeListener treeListener)
    {
        JTree tree = new JTree(treeModel);
        tree.setCellRenderer(getCellRenderer());
        tree.setRootVisible(false);
        tree.setShowsRootHandles(true);

        treeListener.setJTree(tree);
        tree.addTreeSelectionListener(treeListener);
        tree.addMouseListener(treeListener);
        tree.addMouseMotionListener(treeListener);
        tree.addKeyListener(treeListener);

        return tree;
    }
View Full Code Here

    ROOTSAMPLE = new SampleResult();
    ROOTSAMPLE.setSampleLabel(SERVER_TITLE);
    ROOTSAMPLE.setSuccessful(true);
    ROOTNODE = new DefaultMutableTreeNode(ROOTSAMPLE);
    TREEMODEL = new DefaultTreeModel(ROOTNODE);
    SERVERTREE = new JTree(TREEMODEL);
    SERVERTREE.getSelectionModel().setSelectionMode(
      TreeSelectionModel.SINGLE_TREE_SELECTION);
    SERVERTREE.addTreeSelectionListener(this);
    SERVERTREE.setShowsRootHandles(true);
    TREEPANE = new JScrollPane(SERVERTREE);
View Full Code Here

    log.info("Start : getMethodHomeParmsPanel1");
    JPanel panel = new JPanel();
    panel.add(new JLabel(JMeterUtils.getResString("jndi_method_home_parms")));
    rootHome = new DefaultMutableTreeNode("Root");
    treeModelHome = new DefaultTreeModel(rootHome);
    jTreeHome = new JTree(treeModelHome);
    jTreeHome.getSelectionModel().setSelectionMode(
      TreeSelectionModel.SINGLE_TREE_SELECTION);
    jTreeHome.addTreeSelectionListener(this);
    jTreeHome.setPreferredSize(new Dimension(200, 50));
    JPanel jTreePanel = new JPanel();
View Full Code Here

TOP

Related Classes of javax.swing.JTree$TreeTimer

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.