Bug 81334 - [api] Missing TypedListeners or Javadoc for MeasureItem, EraseItem, PaintItem, SetData, and Close, Dispose, OpenDocument, Settings, Skin
Summary: [api] Missing TypedListeners or Javadoc for MeasureItem, EraseItem, PaintItem...
Status: CLOSED WONTFIX
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.1   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform-SWT-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords: api, consistency
: 128375 (view as bug list)
Depends on:
Blocks: 176198 347947
  Show dependency tree
 
Reported: 2004-12-15 16:52 EST by Veronika Irvine CLA
Modified: 2020-02-11 12:21 EST (History)
8 users (show)

See Also:


Attachments
patch (60.83 KB, patch)
2007-01-12 16:11 EST, Grant Gayed CLA
no flags Details | Diff
addition of MouseWheel and MenuDetect (final) (15.39 KB, patch)
2007-03-15 15:11 EDT, Grant Gayed CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Veronika Irvine CLA 2004-12-15 16:52:43 EST
Missing TypedListeners for:

DragDetect
SetData
MenuDetect
MouseWheel
Comment 1 Steve Northover CLA 2005-04-04 15:21:37 EDT
Assigning to Veronika because I seem to be incapable of typing in the classes.
Comment 2 Carolyn MacLeod CLA 2005-07-27 16:53:15 EDT
Adding [consistency] to title and keyword.

Also note that the typed listener classes are a great place to hang doc.
For example, nowhere in all the current code is any example of how to do 
virtual tables/trees - you have to look at snippets or read the Table/Tree 
code to figure it out. SetDataListener, SetDataEvent, and addSetDataListener 
are all good places for virtual table/tree javadoc and a small example.

Also, typed listeners show which widgets you can hook certain events to.
For example, can you add a MenuDetect listener to a Menu? Can you hook 
MouseWheel to a Tracker? The add...Listener methods help people from making 
wierd mistakes and wondering why they never get their expected event.

The event classes help to show which fields are valid. SetData only cares 
about the item field, but you have to read the code to know that...

HardKeyDown/Up are also missing TypedListeners, but we should probably leave 
them alone because they are only used on a small number of platforms (1?).
Comment 3 Markus Keller CLA 2006-02-17 07:07:22 EST
*** Bug 128375 has been marked as a duplicate of this bug. ***
Comment 4 Markus Keller CLA 2006-04-04 12:36:21 EDT
Additional missing typed listeners in HEAD:

Settings
EraseItem
MeasureItem
PaintItem
Comment 5 Markus Keller CLA 2006-08-08 07:13:41 EDT
Could these please be added now that the API freeze is over?
Comment 6 Steve Northover CLA 2006-08-08 10:57:48 EDT
Yes, assigning this to Grant.  I seem to still be incapable of adding this boiler-plate.
Comment 7 Grant Gayed CLA 2007-01-12 16:11:12 EST
Created attachment 56850 [details]
patch

Patch from Masha.  It has not been reviewed or tested yet.
Comment 8 Markus Keller CLA 2007-01-15 05:23:13 EST
The patch from comment 7 also contains unrelated and unfinished changes for org/eclipse/swt/widgets/Tracker.java
Comment 9 Grant Gayed CLA 2007-01-15 09:31:46 EST
I forgot about that, don't apply the Tracker changes.
Comment 10 Steve Northover CLA 2007-01-18 08:06:30 EST
DragDetectEvent and DragDetectListener have been added.
Comment 11 Markus Keller CLA 2007-02-15 05:46:37 EST
This should really go into 3.3.
Comment 12 Markus Keller CLA 2007-02-15 09:48:19 EST
Please note that this is not just boilerplate. It's the *only* API specification for these features. Constants declarations in the SWT class alone do not constitute an API.

I just looked into ItemListener, and found that the method Javadocs need more work. E.g.

/**
 * Sent when the size of a cell's content is needed.
 *
 * @param e an event containing information about the 
 */
public void itemErased(ItemEvent e);

- @param is incomplete
- Description seems inappropriate
- What are implementations supposed to do?
  - Does SWT erase the item to defaults (including selection bg color) or does the client have to do this?
  - How should the client react to itemMeasured(..)? I guess he should fill in some fields of the passed ItemEvent -- if so, then this must be specified. Furthermore, "itemMeasured" sounds like a notification. It should more sound like a command if the client is supposed to do something (e.g. "measureItem").
Comment 13 Steve Northover CLA 2007-02-15 10:25:28 EST
NOTE:  The patch was developed by a coop and has not been reviewed.  See comment #7.
Comment 14 Markus Keller CLA 2007-03-15 06:05:59 EDT
Could this please go in before the API freeze?
Comment 15 Grant Gayed CLA 2007-03-15 15:11:04 EDT
Created attachment 61001 [details]
addition of MouseWheel and MenuDetect (final)

Attached is a patch that adds typed events/listeners for MouseWheel and MenuDetect.  It's attached here first because PMC approval is needed to change api at this stage.  I'll be posting a request to the PMC list shortly.

The TypedEvents in the patch for Display (Close, Dispose, Settings) were not added because the typed listener mechanism currently cannot be used on non-widgets.  It's possible that this could be changed, but not at this stage.

The TypedEvents in the patch for Table/Tree were not added because after discussion with others it was decided that these may not be in their final forms yet (ie.- could grow post-3.3), and do not want to introduce api that could soon require an extension.
Comment 16 Susan McCourt CLA 2007-03-15 15:52:23 EDT
I think the javadoc for MenuDetect is wrong.  The event x and y in this case are display-relative, not widget relative.
Comment 17 Mike Wilson CLA 2007-03-15 16:03:39 EDT
+1 to adding the API
Comment 18 Grant Gayed CLA 2007-03-15 16:20:19 EDT
Susan you're right, thanks for catching this!  I'll update this when the patch is committed (starting now).
Comment 19 Susan McCourt CLA 2007-03-16 12:16:05 EDT
fyi...there is some new JFace API that will make use the typed listener for MenuDetect, so please let us know as soon as this is available in HEAD (see bug #176198)
Comment 20 Grant Gayed CLA 2007-03-16 12:34:27 EDT
MouseWheel and MenuDetect are released.

Keeping the report open for future consideration of the other typed listeners that were not added.
Comment 21 Susan McCourt CLA 2007-03-16 14:44:45 EDT
found a typo (while copying the menu detect javadoc to jface)...
on the remove menu detect listener call, "specific" is spelled wrong.

platform-secific
Comment 22 Grant Gayed CLA 2007-03-16 15:08:21 EDT
fixed, thanks again Susan!
Comment 23 Mike Wilson CLA 2008-09-11 15:34:41 EDT
Is this fixed? If not, what is missing. Are we going to address for 3.5?

Comment 24 Carolyn MacLeod CLA 2010-05-25 11:33:54 EDT
The custom draw stuff (MeasureItem, EraseItem and PaintItem) is still missing.
See bug 312315.
Comment 25 Markus Keller CLA 2014-05-13 08:45:28 EDT
http://www.eclipse.org/articles/article.php?file=Article-CustomDrawingTableAndTreeItems/index.html and SWT snippets already contain some usage examples.
Comment 26 Markus Keller CLA 2014-06-10 10:44:11 EDT
(In reply to Carolyn MacLeod from comment #24)
> The custom draw stuff (MeasureItem, EraseItem and PaintItem) is still
> missing.

And SetData. And the Display events Close, Dispose, OpenDocument, Settings, Skin should also also documented, e.g. in the SWT#xxx event declaration itself.
Comment 27 Markus Keller CLA 2016-01-25 09:39:07 EST
(In reply to Carolyn MacLeod from comment #24)
> The custom draw stuff (MeasureItem, EraseItem and PaintItem) is still
> missing.
From bug 228695: The API needs to specify that the event sequence is always MeasureItem, EraseItem, PaintItem, but there's no guarantee that the latter two are always called after MeasureItem.

Client code already relies on the sequence, see e.g. org.eclipse.jface.viewers.StyledCellLabelProvider#deltaOfLastMeasure
Comment 28 Eclipse Genie CLA 2020-02-11 12:21:35 EST
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug.

If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.