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 61635 - J2EE Palette Client API review
Summary: J2EE Palette Client API review
Status: CLOSED FIXED
Alias: None
Product: xml
Classification: Unclassified
Component: Code (show other bugs)
Version: 5.x
Hardware: All All
: P2 blocker (vote)
Assignee: Libor Kotouc
URL:
Keywords: API, API_REVIEW_FAST
Depends on:
Blocks:
 
Reported: 2005-08-02 07:44 UTC by Libor Kotouc
Modified: 2006-03-01 13:47 UTC (History)
6 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Architecture Questions (45.50 KB, text/html)
2005-08-02 09:01 UTC, Libor Kotouc
Details
Overview of changes in the related modules. (4.06 KB, text/plain)
2005-08-02 09:03 UTC, Libor Kotouc
Details
diff of palette client support (29.82 KB, patch)
2005-08-10 13:00 UTC, Libor Kotouc
Details | Diff
Arch doc diff (3.12 KB, patch)
2005-08-10 13:02 UTC, Libor Kotouc
Details | Diff
Arch doc updated (56.42 KB, text/html)
2005-08-10 13:07 UTC, Libor Kotouc
Details
unit tests (14.67 KB, patch)
2005-08-12 10:58 UTC, Libor Kotouc
Details | Diff
DTD (2.28 KB, text/plain)
2005-08-12 11:01 UTC, Libor Kotouc
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Libor Kotouc 2005-08-02 07:44:44 UTC
Issue covers development of the API of the J2EE Palette client.
Comment 1 Libor Kotouc 2005-08-02 09:01:28 UTC
Created attachment 23412 [details]
Architecture Questions
Comment 2 Libor Kotouc 2005-08-02 09:03:56 UTC
Created attachment 23413 [details]
Overview of changes in the related modules.
Comment 3 Libor Kotouc 2005-08-02 09:05:08 UTC
The reviewers for this issue are pbuzek, jtulach, mroskanin and ppisl.
Comment 4 Libor Kotouc 2005-08-02 09:10:13 UTC
The work on the API already started. The attached documents are continuously
modified to track the planned state and might not exactly correspond to the
current implementation.

The implementation sits on the tag_editor_support branch and is spread among the
following modules:

xml/palettesupport
html
html/editor
html/editor/lib
web/core
web/jspsyntax
Comment 5 Libor Kotouc 2005-08-02 09:25:31 UTC
The following additional changes will be made according to the pbuzek's
suggestions if possible:

1. refactor the code from the html/editor/lib to html/editor
2. refactor the code from the web/jspsyntax to web/core

The following pbuzek's suggestions were already projected into the attached Arch
document:

1. merging of J2EEPaletteItemCustomizer interface into J2EEPaletteItemInsertable
interface
2. the J2EEPaletteItemContext and J2EEPaletteItemCookie classes are no longer needed
3. J2EEPaletteItemDataObject.getCookie() must work with
J2EEPaletteItemInsertable interface instead of J2EEPaletteItemCookie class
4. J2EEPaletteItemInsertable interface must extend Node.Cookie interface
5. the insertion logic implemented int the J2EEPaletteItemCookie class will be
shifted into the code handling the mouse actions executed on the palette
(palette actions, palette listener and drop target), perhaps via some utility method
6. J2EEPaletteItemInsertable.insert(...) method will have the following signature:
insert(JTextComponent, boolean): void;
Comment 6 Petr Pisl 2005-08-02 11:11:52 UTC
Libor, is it possible to attach javadoc?
Comment 7 Libor Kotouc 2005-08-02 12:14:56 UTC
not yet written; it would not correspond with the changes because they are not
yet implemented.
Comment 8 Pavel Buzek 2005-08-02 19:27:56 UTC
basically, the only API for palette items will be:

/** Implementation of this interface must be returned as a cookie
 * from the node that represents J2EE palette items.
 */
J2EEPaletteItemInsertable extends Node.Cookie {

  /** Insert the component represented by the palette item 
   * into the text component. If the palette item has a customizer
   * and the showCustomizer is true then the cutomizer should be 
   * displayed prior to insertion.
   *
   * @param textComponent the TextComponent into which the item should be added
   * @param showCustomzier if false do not show customzier, if true show
   *  a customizer if the item has any
   */
  void insert(JTextComponent textComponent, boolean showCustomizer);
}

The editor will create the palette and in its PaletteActions it will lookup the
J2EEPaletteItemInsertable and call the insert method. The second parameter was
added to make it possible to suppress the customizer and just add the item in a
default way (e.g. when a modified key is pressed).

Comment 9 Petr Jiricka 2005-08-03 07:45:41 UTC
As I wrote in a private e-mail, I don't see a reason to have the word "J2EE" in
API class names, because this is a general interface between the palette and the
editor, not specific to J2EE. My preference would be "EditorPaletteItemInsertable".
Comment 10 Martin Roskanin 2005-08-04 13:11:00 UTC
MR01: xml/palettesupport module depends on editor module. Because of one usage
of  NbEditorUtilities.getDataObject(d) in DnDUtilities.getPath(). Please remove
this dependency and use:
      Object sdp = doc.getProperty(Document.StreamDescriptionProperty);
        if (sdp instanceof DataObject) {
            return (DataObject)sdp;
        }
instead.

MR02: please do not use editor's BaseDocument in your API. As in:
J2EEPaletteItemContext class: public BaseDocument getTargetDocument() or
setTargetDocument(BaseDocument targetDocument). Use Document instead.

MR03: setters in API class J2EEPaletteItemContext like: setTargetDocument or
setAttributeValue or Attribute.setValue look very suspicious to me.

MR04: editor/lib package is standalone library. It shoudn't depend on openide
(with exception of openide.util package) packages like:
org.openide.loaders
org.openide.dialogs
org.openide.nodes
org.netbeans.spi.palette
org.netbeans.modules.projectapi
org.netbeans.modules.editor
org.openide.explorer
Please, move your implementations from html/editor/lib to html/editor/src 




Comment 11 Martin Roskanin 2005-08-04 13:35:32 UTC
MR05: packages like:
org.netbeans.editor.ext.palette.api
org.netbeans.editor.ext.palette.spi
org.netbeans.editor.ext.palette.support
org.netbeans.editor.ext.dnd.api
org.netbeans.editor.ext.dnd.spi
are not very good idea, because we plan to deprecate org.netbeans.editor and
org.netbeans.editor.ext contents in the future completely. Maybe
org.netbeans.modules.editor.palette.api or org.netbeans.lib.editor.palette.api
would be better.


 
Comment 12 Libor Kotouc 2005-08-10 13:00:42 UTC
Created attachment 23633 [details]
diff of palette client support
Comment 13 Libor Kotouc 2005-08-10 13:02:52 UTC
Created attachment 23634 [details]
Arch doc diff
Comment 14 Libor Kotouc 2005-08-10 13:07:48 UTC
Created attachment 23635 [details]
Arch doc updated
Comment 15 Jaroslav Tulach 2005-08-10 17:28:01 UTC
To be short:  
1. I do not like the level of indirection needed to create ActiveEditorDrop 
instance. It would be simpler to have  
 
!ELEMENT active-editor-drop EMPTY> 
+<!ATTLIST active-editor-drop  
+    class CDATA #REQUIRED 
+> 
 
and just do Class.forName(className, true, 
Thread.getContextClassLoader()).newInstance() - imho this would be simpler for 
users. 
 
2. No tests - I'd like to see registration of XML file with body and 
ActiveEditorDrop into layer, creation of Palette over a directory and 
iteration over the nodes of the palette to find out the node is really there, 
the icons and names are ok and that the drag(), getLookup(), clipboardCopy 
contain what they should contain. Imho this is more important then any effort 
for good design. 
Comment 16 Libor Kotouc 2005-08-10 18:02:18 UTC
ad 1. there is no indirection, item implementor writes directly the class name
(it is already implemented, I forgot to document it in the arch doc)

ad 2. currently working on it
Comment 17 Jaroslav Tulach 2005-08-11 10:46:34 UTC
re.1: sorry, I overlooked that. re.2: ok. allandall: ok, from me. I guess. 
Comment 18 Petr Jiricka 2005-08-11 14:54:49 UTC
PJ01: The DTD should be documented (inline, not in the arch. document), so the
clients know what each element means. Currently, it's not easy to figure out.
Comment 19 Libor Kotouc 2005-08-12 10:58:56 UTC
Created attachment 23752 [details]
unit tests
Comment 20 Libor Kotouc 2005-08-12 11:01:59 UTC
Created attachment 23753 [details]
DTD
Comment 21 Jaroslav Tulach 2005-08-19 15:20:13 UTC
As far as I know we turned this into a fasttrack with a small addition to 
core/palette. I am adding API_REVIEW_FAST. 
 
Also I guess this is now fixed and integrated. So I guess this issue can be 
closed. Meanwhile it is a defect that it is open, is it not? 
Comment 22 Libor Kotouc 2005-08-19 15:39:37 UTC
Yes, you are right.
Comment 23 Jiri Kovalsky 2006-03-01 13:47:11 UTC
Closing DevRev issue.