|
org.netbeans.modules.looks/2 1.12 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ChangeableLookProvider
Interface for finding a Looks for given represented object. To create
a LookSelector
implement this interface and call
Selectors.selector( ChangeableLookProvider )
. LookSelectors created
from this interface are allowed to change the content. To do so you have
to implement the addChangeListener(javax.swing.event.ChangeListener)
method and fire the changes
on the registered listener. Typical implementation of the method
would look like:
if ( this.listener != null ) {
throw new TooManyListenersException();
}
else {
this.listener = listener;
}
and fire method would look like:
listener.stateChanged( new ChangeEvent( this ) );
Notice that it is usually not necessary to create a list of listeners and rather throw TooManyListeners exception if there would be more than one listener registered. The reason is that reusing one instance of ChangeableLookProvider would result in two LookSelectors with the same behavior i.e. you may rather want to reuse the LookSelector than the Provider.
Method Summary | |
---|---|
void |
addChangeListener(ChangeListener listener)
Registers listener for changes in the Provider's content. |
Object |
getKeyForObject(Object representedObject)
Returns key for given object. |
Enumeration |
getLooksForKey(Object key)
Finds all suitable Looks for given key. |
Method Detail |
---|
Enumeration getLooksForKey(Object key)
key
- The key we want to find available looks for.
Object getKeyForObject(Object representedObject)
representedObject
- The represented object we want to find key for.
null
instead of a key will result in returning empty Enumeration
from the LookSelector.void addChangeListener(ChangeListener listener) throws TooManyListenersException
listener
- The listenet which should be notified when change in
the Provider's content occurs.
TooManyListenersException
- May be thrown when more than one
listener is registered.for info about correct behavior of the Provider
|
org.netbeans.modules.looks/2 1.12 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |