This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 61624 - [DevRev] Consider using javax.swing.text.Element for document elements
Summary: [DevRev] Consider using javax.swing.text.Element for document elements
Status: RESOLVED WONTFIX
Alias: None
Product: xml
Classification: Unclassified
Component: API (show other bugs)
Version: 5.x
Hardware: All All
: P3 blocker (vote)
Assignee: Marek Fukala
URL:
Keywords:
Depends on:
Blocks: 61412
  Show dependency tree
 
Reported: 2005-08-01 18:25 UTC by Andrei Badea
Modified: 2007-09-25 01:29 UTC (History)
4 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrei Badea 2005-08-01 18:25:57 UTC
This issue resulted from the Tag Editor Support API Inception Review.

The DocumentElement class looks similar to javax.swing.text.Element. Consider
using this interface for document elements.
Comment 1 Marek Fukala 2005-08-03 13:04:20 UTC
I have left the DocumentElement without proposed changes mainly from following
reasons:

1) There is a need to have an ability to attach change listeners to the
DocumentElement-s. This kind of functionality is not provided by the
j.s.t.DocumentElement

2) It's common approach to better have final classes in the API that interfaces

3) This is not possible to extend (add a method) to the j.s.t.DocumentElement in
a future.
Comment 2 Miloslav Metelka 2005-08-03 14:11:26 UTC
IMHO it would still be beneficial to implement Element by the final class (of
course only if the methods in the final class match those in the Element
interface) to give a notion what methods are in the class. But I don't have a
strong opinion regarding this.
Comment 3 Marek Fukala 2005-08-03 16:26:26 UTC
OK. I will make the DocumentElement implement j.s.t.Element.
Comment 4 Marek Fukala 2005-08-03 16:30:10 UTC
fixed - now the DocumentElement implements j.s.t.Element + has following
additional methods (which are either necessary or very usefull):

    public DocumentModel getDocumentModel();
    
    /** Returns a type of the element. */
    public String getType();
    
    /** Returns a list of children elements. */
    public List getChildren();
    
    /** Adds a DocumentElementListener to this DocumentElement instance */
    public void addDocumentElementListener(DocumentElementListener del);
    
    /** Removes a DocumentElementListener to this DocumentElement instance */
    public void removeDocumentElementListener(DocumentElementListener del);
Comment 5 Marek Fukala 2005-08-10 16:06:56 UTC
Oops, I encountered a problem with the DocumentElement implementing
j.s.t.Element :-(.

In JDK1.5 following example is valid:

public class Main {
    public class XC implements X {
        public XC getX() {
            return (XC)null;
        }
    }
    public interface X {
        public X getX();
    }
}

The overriding method returns a supertype of the type declared in the overrided
method. However this does not work in JDK1.4. A possible solution would be to
return the original interface, but this would cause a need to recast the type in
many places.

So I am removing the changes - DocumentElement does not implement the Element
interface, though it has all its methods. 
Comment 6 Marek Fukala 2005-08-10 16:08:10 UTC
I can fix this when we use 1.5 for the NB build.
Comment 7 Marek Fukala 2005-08-10 16:21:23 UTC
Based on QE notification that the RESOLVED LATER state of issues should not be
used at all I am changing this issue to an NEW ENHANCEMENT (NEW DEFECT would
allegedly affect the statistics).
Comment 8 Jaroslav Pospisil 2006-03-13 13:35:27 UTC
TM 5.0->TBD
Comment 9 Jaroslav Tulach 2006-12-01 10:33:15 UTC
This issue (as several others which I am changing at once) as a TCR or TCA, 
but it is not a defect. As I am aware of our attitude towards non-defects - 
e.g. ignore them, I believe it is safe to assume that these issues are never 
going to be fixed. As such I am closing them. If anyone believes that this 
issue is important to be fixed, then please reopen. In such case I suggest to 
track it then as a defect.