Package org.itsnat.comp.tree

Examples of org.itsnat.comp.tree.ItsNatFreeTree


            if (dataNode == null)
                selectDefault(featShowDoc)// Feature not found (may be an old link no longer valid)
            else
            {
                FeatureTreeNode feature = (FeatureTreeNode)dataNode.getUserObject();
                ItsNatFreeTree tree = featShowDoc.getItsNatFreeTree();
                DefaultTreeModel dataModel = (DefaultTreeModel)tree.getTreeModel();
                TreePath path = new TreePath(dataModel.getPathToRoot(dataNode));

                String panelName = featureNameComplete.substring(pos + 1,featureNameComplete.length());
                int panel = feature.getPanelCode(panelName);
View Full Code Here


        }
    }

    public static void selectDefault(FeatureShowcaseDocument featShowDoc)
    {
        ItsNatFreeTree tree = featShowDoc.getItsNatFreeTree();
        DefaultTreeModel dataModel = (DefaultTreeModel)tree.getTreeModel();

        DefaultMutableTreeNode dataNode = (DefaultMutableTreeNode)dataModel.getRoot();
        FeatureTreeNode feature = (FeatureTreeNode)dataNode.getUserObject();
        methodDirect(new TreePath(dataModel.getRoot()),feature,feature.getFirstPanel());
    }
View Full Code Here

    }

    public static void methodDirect(TreePath path,FeatureTreeNode feature,int panel)
    {
        FeatureShowcaseDocument featShowDoc = feature.getFeatureShowcaseDocument();
        ItsNatFreeTree tree = featShowDoc.getItsNatFreeTree();

        feature.setOnloadTargetPanel(panel);

        TreeSelectionModel selModel = tree.getTreeSelectionModel();
        selModel.setSelectionPath(path);
    }
View Full Code Here

    }

    public static void methodEventUsingBrowser(final TreePath path,final FeatureTreeNode feature,final int panel)
    {
        FeatureShowcaseDocument featShowDoc = feature.getFeatureShowcaseDocument();
        final ItsNatFreeTree tree = featShowDoc.getItsNatFreeTree();
        final ItsNatDocument itsNatDoc = feature.getItsNatDocument();
        final ItsNatHTMLInputCheckBox joystickCB = featShowDoc.getJoystickModeCheckBox();

        Runnable dispCode = new Runnable()
        {
            public void run()
            {
                // Joystick mode temporally disabled, because on load time and fast load,
                // event listeners in the component are not added until the load event is fired.

                boolean useJoystick = joystickCB.isSelected();
                if (useJoystick) joystickCB.setSelected(false);

                Element featureElem;
                MouseEvent event1;
                synchronized(itsNatDoc)
                {
                    featureElem = tree.getItsNatTreeUI().getParentElementFromTreePath(path);
                    event1 = createMouseEvent(itsNatDoc);
                }
                ((EventTarget)featureElem).dispatchEvent(event1); // Select feature

                if (panel == feature.getFirstPanel())
                    return;

                for( ; ; )
                {
                    synchronized(itsNatDoc)
                    {
                        if (tree.getTreeSelectionModel().isPathSelected(path))
                            break;
                    }
                    try{ Thread.sleep(200); }catch(InterruptedException ex) { throw new RuntimeException(ex); }
                }
View Full Code Here

    {
        // Note: this technique may be problematic in fastLoadMode = true if the target
        // panel is not the "example" panel because the example panel is loaded and discarded.

        FeatureShowcaseDocument featShowDoc = feature.getFeatureShowcaseDocument();
        ItsNatFreeTree tree = featShowDoc.getItsNatFreeTree();
        ItsNatDocument itsNatDoc = feature.getItsNatDocument();
        ItsNatHTMLInputCheckBox joystickCB = featShowDoc.getJoystickModeCheckBox();

        // Joystick mode temporally disabled, because on load time and fast load,
        // event listeners in the component are not added until the load event is fired.
        boolean useJoystick = joystickCB.isSelected();
        if (useJoystick) joystickCB.setSelected(false);
           
        Element featureElem = tree.getItsNatTreeUI().getParentElementFromTreePath(path);
        MouseEvent event1 = createMouseEvent(itsNatDoc);
        ((EventTarget)featureElem).dispatchEvent(event1); // Select feature

        if (panel == feature.getFirstPanel())
            return;
View Full Code Here

        ((DefaultTableModel)freeTable.getTableModel()).addColumn("Col 1");
        ((DefaultTableModel)freeTable.getTableModel()).addColumn("Col 2");
        ((DefaultTableModel)freeTable.getTableModel()).addRow(new String[]{"Item 1,1","Item 1,2"});
        ((DefaultTableModel)freeTable.getTableModel()).addRow(new String[]{"Item 2,1","Item 2,2"});
        // Trees
        ItsNatFreeTree freeTree = (ItsNatFreeTree)compMgr.findItsNatComponentById("freeTreeId");
        check(freeTree);
        ((DefaultTreeModel)freeTree.getTreeModel()).setRoot(new DefaultMutableTreeNode("Free Tree"));

        ItsNatFreeTree freeTreeRootless = (ItsNatFreeTree)compMgr.findItsNatComponentById("freeTreeRootlessId");
        check(freeTreeRootless);
        DefaultMutableTreeNode root = new DefaultMutableTreeNode("Root (hidden)");
        root.add(new DefaultMutableTreeNode("Free Tree Rootless"));
        ((DefaultTreeModel)freeTreeRootless.getTreeModel()).setRoot(root);

        ItsNatFreeTree freeTreeTable = (ItsNatFreeTree)compMgr.findItsNatComponentById("freeTreeTableId");
        check(freeTreeTable);
        ((DefaultTreeModel)freeTreeTable.getTreeModel()).setRoot(new DefaultMutableTreeNode("Free Tree Table"));

        ItsNatHTMLForm form = (ItsNatHTMLForm)compMgr.findItsNatComponentById("formId");
        check(form);

        ItsNatFreeInclude freeInclude = (ItsNatFreeInclude)compMgr.findItsNatComponentById("freeIncludeId");
View Full Code Here

        return "freeTree";
    }

    public ItsNatFreeTree createItsNatFreeTree(Element element,NameValue[] artifacts,boolean execCreateFilters,ItsNatDocComponentManagerImpl compMgr)
    {
        ItsNatFreeTree comp = null;
        boolean doFilters = hasBeforeAfterCreateItsNatComponentListener(execCreateFilters,compMgr);
        if (doFilters) comp = (ItsNatFreeTree)processBeforeCreateItsNatComponentListener(element,getCompType(),null,artifacts,compMgr);
        if (comp == null)
            comp = new ItsNatFreeTreeImpl(element,artifacts,compMgr);
        if (doFilters) comp = (ItsNatFreeTree)processAfterCreateItsNatComponentListener(comp,compMgr);
View Full Code Here

        return comp;
    }

    public ItsNatFreeTree createItsNatFreeTree(Element element,boolean treeTable,boolean rootless,ItsNatTreeStructure structure,NameValue[] artifacts,boolean execCreateFilters,ItsNatDocComponentManagerImpl compMgr)
    {
        ItsNatFreeTree comp = null;
        boolean doFilters = hasBeforeAfterCreateItsNatComponentListener(execCreateFilters,compMgr);
        if (doFilters) comp = (ItsNatFreeTree)processBeforeCreateItsNatComponentListener(element,getCompType(),getParams(treeTable,rootless,structure),artifacts,compMgr);
        if (comp == null)
            comp = new ItsNatFreeTreeImpl(treeTable,rootless,element,structure,artifacts,compMgr);
        if (doFilters) comp = (ItsNatFreeTree)processAfterCreateItsNatComponentListener(comp,compMgr);
View Full Code Here

    public static void TREES()
    {
        ItsNatDocument itsNatDoc = null;
        ItsNatComponentManager componentMgr = itsNatDoc.getItsNatComponentManager();

        ItsNatFreeTree treeComp = (ItsNatFreeTree)componentMgr.createItsNatComponentById("compId","freeTree",null);

        new FreeTreeDecorator(treeComp).bind();

        DefaultTreeModel dataModel = (DefaultTreeModel)treeComp.getTreeModel();

        DefaultMutableTreeNode rootNode = new DefaultMutableTreeNode("Grey�s Anatomy");
        dataModel.setRoot(rootNode);

        DefaultMutableTreeNode parentNode;

            parentNode = addNode("Characters",rootNode,dataModel);

                addNode("Meredith Grey",parentNode,dataModel);
                addNode("Cristina Yang",parentNode,dataModel);
                addNode("Alex Karev",parentNode,dataModel);
                addNode("George O'Malley",parentNode,dataModel);

            parentNode = addNode("Actors",rootNode,dataModel);

                addNode("Ellen Pompeo",parentNode,dataModel);
                addNode("Sandra Oh",parentNode,dataModel);
                addNode("Justin Chambers",parentNode,dataModel);
                addNode("T.R. Knight",parentNode,dataModel);

        TreeSelectionModel selModel = treeComp.getTreeSelectionModel();
        selModel.setSelectionMode(TreeSelectionModel.CONTIGUOUS_TREE_SELECTION);

        selModel.addSelectionPath(new TreePath(parentNode.getPath())); // Actors

        TreeModelListener dataListener = new TreeModelListener()
        {
            public void treeNodesChanged(TreeModelEvent e)
            {
                treeChangedLog(e);
            }

            public void treeNodesInserted(TreeModelEvent e)
            {
                treeChangedLog(e);
            }

            public void treeNodesRemoved(TreeModelEvent e)
            {
                treeChangedLog(e);
            }

            public void treeStructureChanged(TreeModelEvent e)
            {
                treeChangedLog(e);
            }

            public void treeChangedLog(TreeModelEvent e)
            {
                System.out.println(e.toString());
            }
        };
        dataModel.addTreeModelListener(dataListener);

        TreeSelectionListener selListener = new TreeSelectionListener()
        {
            public void valueChanged(TreeSelectionEvent e)
            {
                TreeSelectionModel selModel = (TreeSelectionModel)e.getSource();

                TreePath[] paths = e.getPaths();
                String fact = "";
                for(int i = 0; i < paths.length; i++)
                {
                    TreePath path = paths[i];
                    boolean selected = selModel.isPathSelected(path);
                    if (selected)
                        fact += ", selected ";
                    else
                        fact += ", deselected ";
                    fact += path.getLastPathComponent();
                }

                System.out.println("Selection changes" + fact);
            }
        };
        selModel.addTreeSelectionListener(selListener);

        TreeWillExpandListener willExpandListener = new TreeWillExpandListener()
        {
            public void treeWillExpand(TreeExpansionEvent event) throws ExpandVetoException
            {
                // Will expand
            }

            public void treeWillCollapse(TreeExpansionEvent event) throws ExpandVetoException
            {
                // Will collapse
            }
        };
        treeComp.addTreeWillExpandListener(willExpandListener);
    }
View Full Code Here

    public static void TREES_ROOTLESS()
    {
        ItsNatComponentManager compMgr = null;

        NameValue[] artifacts = new NameValue[]{new NameValue("rootless","true")};
        ItsNatFreeTree treeComp = (ItsNatFreeTree)compMgr.createItsNatComponentById("compId","freeTree",artifacts);
    }
View Full Code Here

TOP

Related Classes of org.itsnat.comp.tree.ItsNatFreeTree

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.