Results 1 to 5 of 5
Like Tree1Likes
  • 1 Post By gimbal2

Thread: SwiXml - Issue in providing checkbox for JTree nodes

  1. #1
    msambasiva is offline Member
    Join Date
    Jun 2013
    Posts
    14
    Rep Power
    0

    Default SwiXml - Issue in providing checkbox for JTree nodes

    Hi,

    We are using SwiXml 1.5 to develop a UI. We are getting issue while displaying JTree with checkbox option. We found below url to achieve the same thing
    CheckBox Tree node : JTree Node¬*¬ę¬*Swing¬*¬ę¬*Java Tutorial

    We have customised the TreeTest.java class as per SwiXml

    We have configured the XML with InitClass as below

    XML Code:
    <scrollpane id="ehdd_task_tree">  
            <gridbagconstraints insets="5,5,5,5" gridx="1" gridy="1" weightx="1.0"  
                                weighty="1.0" fill="GridBagConstraints.BOTH"  
                                anchor="GridBagConstraints.WEST"/>  
            <tree id="ehdd_tree" initclass="com.oracle.appsfdoc.fusion.sos.TreeTest" Font="ARIAL-BOLD-14" VisibleRowCount="10" RootVisible="TRUE" ExpandsSelectedPaths="true"/>  
        </scrollpane>
    Following is TreeTest.java
    ==========================

    XML Code:
        public class TreeTest extends DefaultTreeModel   
        {  
          
          protected final static String[] questions = { "A","B","C" };  
          DefaultMutableTreeNode root ;  
          
          public TreeTest() {  
            super(new DefaultMutableTreeNode ("ROOT"));  
              root = (DefaultMutableTreeNode)super.getRoot();  
              JTree tree = new JTree( getRootNode() ) {  
              public boolean isPathEditable(TreePath path) {  
                Object comp = path.getLastPathComponent();  
                if (comp instanceof DefaultMutableTreeNode) {  
                  DefaultMutableTreeNode node = (DefaultMutableTreeNode) comp;  
                  Object userObject = node.getUserObject();  
                  if (userObject instanceof TrueFalseTreeNodeData) {  
                    return true;  
                  }  
                }  
                return false;  
              }  
            };  
            tree.setCellRenderer(new QuestionCellRenderer());  
            tree.setCellEditor(new QuestionCellEditor());  
            tree.setEditable(true);  
          }  
          
          protected MutableTreeNode getRootNode() {  
            DefaultMutableTreeNode child;  
            TrueFalseTreeNodeData question;  
            for (int i = 0; i < questions.length; i++) {  
              question = new TrueFalseTreeNodeData(questions[i]);  
              child = new DefaultMutableTreeNode(question);  
              root.add(child);  
            }  
            return root;  
          }  
        }
    We can find other required class files(QuestionCellRenderer/QuestionCellEditor/TrueFalseTreeNodeData) from the URL
    CheckBox Tree node : JTree Node¬*¬ę¬*Swing¬*¬ę¬*Java Tutorial

    We are successfully executed the jave program given in above URL. We are getting issue with our customization according SwiXml.

    We are getting A=false,B=false,c=false under ROOT. Some how, could not able to provide checkbox for the subnodes of tree.

    Please suggest, if Iam doing some thing wrong.

    It would be really great help, if you can suggest on this.

    Thanks,
    Samba.

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,188
    Rep Power
    19

    Default Re: SwiXml - Issue in providing checkbox for JTree nodes

    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  3. #3
    msambasiva is offline Member
    Join Date
    Jun 2013
    Posts
    14
    Rep Power
    0

    Default Re: SwiXml - Issue in providing checkbox for JTree nodes

    Hi,

    Yes..I've posted the same query at two forums to get a suggestion to fix our issue. Please suggest the process to get resolution on the issue.

    Am I doing some thing wrong with posting the same query at two forums?

    Thanks,
    Samba.

  4. #4
    SurfMan's Avatar
    SurfMan is online now Godlike
    Join Date
    Nov 2012
    Location
    The Netherlands
    Posts
    901
    Rep Power
    2

    Default Re: SwiXml - Issue in providing checkbox for JTree nodes

    Quote Originally Posted by msambasiva View Post
    Hi,
    Am I doing some thing wrong with posting the same query at two forums?
    Not wrong, but you should have mentioned it. It could be possible that the solution is offered on a different forum, so people here don't have to put in any more time. (https://www.coderanch.com/how-to/jav...ngToOtherSites)

  5. #5
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    3,653
    Rep Power
    5

    Default Re: SwiXml - Issue in providing checkbox for JTree nodes

    Quote Originally Posted by msambasiva View Post
    Hi,

    Am I doing some thing wrong with posting the same query at two forums?
    No, but you are doing something wrong by not posting links to your duplicate posts. Imagine this: I, generous that I am, take an interest in your problem. I take my time (which tends to be time at work, not time at home) to study your problem and to research a little into it to find possible solutions. Then I spend a good amount of time formulating an answer that is correct and you can understand. Lets take a worst case scenario: I spend an hour doing that.

    Only to figure out that all that time was wasted because someone else had already provided an answer in another forum. Say that happens to you - wouldn't you be pissed at the person who silently crossposted his question? When you make the little bit of effort to post the links to the other forums, people can see if an answer hasn't already been given.
    SurfMan likes this.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

Similar Threads

  1. SwiXML - JTree LazyLoad Expand listener issue
    By msambasiva in forum AWT / Swing
    Replies: 5
    Last Post: 06-27-2013, 09:30 AM
  2. Netbeans: Add nodes to JTree?
    By mishathegoat in forum AWT / Swing
    Replies: 8
    Last Post: 11-15-2010, 01:55 AM
  3. How to dynamically add Nodes to JTree?
    By javanewbie in forum AWT / Swing
    Replies: 3
    Last Post: 07-13-2009, 07:20 AM
  4. JcheckBoxes as JTree Nodes
    By aneesahamedaa in forum AWT / Swing
    Replies: 11
    Last Post: 02-11-2009, 12:11 AM
  5. Nodes displayed in JTree
    By Orange in forum AWT / Swing
    Replies: 6
    Last Post: 08-08-2008, 05:07 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •