views:

43

answers:

1

I have trouble understanding this. Basically, this Lookup API is used to keep loosely coupled intermodule nature. So basically a service provider and consumer modules can each communicate with each other using the Lookup API correct ?

But what I don't understand is:

is Lookup like a bag full of which objects for that Class? Can someone give an easier analogy ?

So the dependencies is created, and you implement the LookupListener in the service consumer correct ? Obviously consumer has dependency on provider.

Then what is the implementation of LookupListener listening to ? It's own Lookup ? So if there is a map of another module's class, it will be stored as an object inside Lookup of the implementation of LookupListener ?

So lookup is kind of like a bag that can store another module's classes and it's methods ?

Is this the correct process of determining a selection ?

  1. in the TopComponent (view) you implement the Lookup Listener, and action Listener.
  2. you make a new object (from the other module)
  3. associateLookup(Lookups.singleton(fff)); again, confusion with this line: what is associateLookup() exactly doing ?
  4. result = Utilities.actionsGlobalContext().lookupResult(Browser1.class); what is this line doing ? what is result ? does it contain the Browser1 class (from other module) ?
  5. result.addLookupListener (this); Why would you add listener to result ? and what are we listening for and why on the TopComponent ?

  6. Done ?

And finally, to further my confusion , how does Node API come into pla7y ?

A: 

There is a good discussion of the NetBeans platform Lookup API.

vkraemer