Bug 37199 - Addition of method WindowManager.findTopComponent(String tcID)
Addition of method WindowManager.findTopComponent(String tcID)
Status: RESOLVED FIXED
Product: platform
Classification: Unclassified
Component: Window System
3.x
All All
: P1 (vote)
: 3.x
Assigned To: mslama
issues@platform
11/20/2003
: API, API_REVIEW_FAST
Depends on: 37141
Blocks:
  Show dependency treegraph
 
Reported: 2003-11-13 13:29 UTC by mslama
Modified: 2008-12-22 19:35 UTC (History)
2 users (show)

See Also:
Issue Type: TASK
:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description mslama 2003-11-13 13:29:20 UTC
Addition of method:
TopComponent
WindowManager.findTopComponentForID(String tcID)
is necessary to be able to deserialize singleton
TopComponent instance using window system
infrastructure. By this way deserialized instance
is also registered in winsys so method
findTopComponentID(TopComponent tc) will return
correct ID. Addition of this method will fix issue
#37141. Currently when module creates singleton TC
instance using static accessor no data are
deserialized so persistent state is effectively lost.
Comment 1 mslama 2003-11-13 13:31:43 UTC
Exact signature of added method is:
public TopComponent WindowManager.findTopComponentForID(String tcID)
Comment 2 Tomas Pavek 2003-11-13 16:10:47 UTC
How would this affect modules? Say if Component Inspector is not
deserialized correctly now, what will I have to do with the new method
to make it work?
Comment 3 mslama 2003-11-13 16:27:02 UTC
Described in issue #37141: There must be 2 accessor methods:
TopComponent must have 2 static accessor methods:
1.create instance using constructor:
if (DEFAULT == null) {
    DEFAULT = new MyTopComponent();
}
2.call findTopComponentID("runtime") if it returns null (nothing is
serialized) call first accessor method

First accessor is reserved only for winsys (InstanceDataObject) to be
able to create correctly TC instance from settings file when method is
given ie. no serialized data in settings file

Second accessor will be used as standard singleton accessor by module.
So module must add second accessor in addition to existing one which
will call findTopComponentID. Of course module knows what is correct
TC ID (settings file name) because module defines this TC in its layer.
Comment 4 Tomas Pavek 2003-11-13 18:02:05 UTC
I see. I assume that by 'findTopComponentID' and
'findTopComponentForID' you mean just the one method...
Comment 5 mslama 2003-11-14 08:25:31 UTC
> I see. I assume that by 'findTopComponentID' and
> 'findTopComponentForID' you mean just the one method.

No NOT at all. These are 2 different methods!!
String findTopComponentID(TopComponent) returns always String ID for
TopComponent instance whereas
TopComponent findTopComponentForID(String ID) returns TopComponent
instance for String ID if possible (if there is such TopComponent
instance already created or it is possible create it by desrialization).

So these are two different but complementary methods.
'findTopComponentID' is already present in API. We want to add missing 
'findTopComponentForID' (possible full name would be
'findTopComponentForTopComponentID' but it would be too long). If
anybody have any suggestion for better name we can discuss it.
Comment 6 Tomas Pavek 2003-11-14 08:41:45 UTC
Okay, I was just confused by your

> 2.call findTopComponentID("runtime") if it returns null...

from above. So it was just a typo, should be ..ForID(..

As for naming these two methods, I'd like:
  String getTopComponentID(TopComponent tc)
  TopComponent findTopComponent(String id)
That would make it clear. But you'd have to rename the existing method
which is a problem. So I basically agree with what you propose.
Comment 7 mslama 2003-11-14 08:57:03 UTC
Yes exactly. It was typo. Sorry for confusion. So again correctly:

First accessor reserved for widow system should be:
if (DEFAULT == null) {
    DEFAULT = new MyTopComponent();
}
return DEFAULT;

Second accessor used publicly:
if (DEFAULT == null) {
    TopComponent tc = findTopComponentForID("runtime");
    if (tc instanceof MyTopComponent) {
        DEFAULT = (MyTopComponent) tc;
    }
    if (DEFAULT == null) {
         call first accessor;
    }
}
Comment 8 Jaroslav Tulach 2003-11-14 10:20:55 UTC
My slight preference is to name the new method as
  TopComponent findTopComponent(String id)
to be consistent with other find methods of pattern
  <type> find<type> (....)
and also knowing that even Marek made mistake when typing it.
Comment 9 apireviews 2003-11-14 17:09:24 UTC
go for fast track review
Comment 10 Jaroslav Tulach 2003-11-24 15:48:16 UTC
11/20/2003 is gone. No other comments applied. Does that mean Marek
can go and implement this? I am assigning back to him, if that is an
incorrect decision, please override today.
Comment 11 mslama 2003-11-25 09:38:30 UTC
Ok. Going to add method TopComponent findTopComponent(String tcID) to
WindowManager.
Comment 12 mslama 2003-11-28 15:31:56 UTC
Fixed in main trunk. openide spec version changed to 4.15. Method
TopComponent findTopComponent(String) added to WindowManager.


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo