From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,3881e541598538ae,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-03-17 01:38:53 PST Path: nntp.stanford.edu!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!feed2.news.rcn.net!rcn!newsfeed1.earthlink.net!newsfeed.earthlink.net!newsmaster1.prod.itd.earthlink.net!newsread1.prod.itd.earthlink.net.POSTED!not-for-mail Message-ID: <3AB2080E.7C0DFB53@earthlink.net> From: "Marc A. Criley" Organization: Quadrus Corporation X-Mailer: Mozilla 4.73 [en] (X11; U; Linux 2.2.14-5.0 i686) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: JGNAT, TreeModels, and interfaces Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Date: Fri, 16 Mar 2001 13:31:27 GMT NNTP-Posting-Host: 158.252.123.199 X-Complaints-To: abuse@earthlink.net X-Trace: newsread1.prod.itd.earthlink.net 984749487 158.252.123.199 (Fri, 16 Mar 2001 05:31:27 PST) NNTP-Posting-Date: Fri, 16 Mar 2001 05:31:27 PST Xref: nntp.stanford.edu comp.lang.ada:91506 Date: 2001-03-16T13:31:27+00:00 List-Id: With JGNAT 1.1p on RedHat Linux 6.2... I've built a JTree structure, and now I need to update one of its leaves programmatically, i.e., by the program, not through user editing. Having generated the new leaf node, I need to inform the tree to display it. It appears the way to do this is using the "nodeChanged" method in the javax.swing.tree.defaultTreeModel class. The Ada binding to this method is: procedure nodeChanged (This : access Typ; P1_TreeNode : access javax.swing.tree.TreeNode.Typ'Class); where "Typ" is the DefaultTreeModel tagged type. So besides the new node, I also need to specify an instance of the DefaultTreeModel. Here's where the problem comes in. To me, it seems that I ought to get the tree model from the tree using the getModel method from javax.swing.jtree, since what I'm working with is a Jtree. The method looks like this: function getModel (This : access Typ) return javax.swing.tree.TreeModel.Ref; I pass in my Jtree and get back a handle to a TreeModel...which is _not_ a DefaultTreeModel. TreeModel is in fact a Java interface that DefaultTreeModel implements. I can't figure out how to get that TreeModel into a form that I can pass to a DefaultTreeModel procedure. In Java, it appears that a typecast is performed. But this won't fly in Ada because these two classes are independent of one another and so can't be converted. A DefaultTreeModel implements the TreeModel interface, so if I was getting a DefaultTreeModel I could easily get at its TreeModel capabilities, but I'm getting the TreeModel and somehow need to upgrade that to a DefaultTreeModel instead. Suggestions are welcome :-) Marc A. Criley