org.netbeans.spi.wizard
Class WizardPage.CustomComponentListener

java.lang.Object
  extended by org.netbeans.spi.wizard.WizardPage.CustomComponentListener
Enclosing class:
WizardPage

public abstract static class WizardPage.CustomComponentListener
extends java.lang.Object

Implement this class if you are using custom Swing or AWT components, and return an instance of it from WizardPage.createCustomComponentListener().


Constructor Summary
Constructor and Description
WizardPage.CustomComponentListener()
           
 
Method Summary
Modifier and Type Method and Description
abstract  boolean accept(java.awt.Component c)
          Indicates that this CustomComponentListener will take responsibility for noticing events from the passed component, and that the WizardPage should not try to automatically listen on it (which it can only do for standard Swing components and their children).
 boolean isContainer(java.awt.Component c)
          Determine if the passed component is a container whose children may need to be listened on.
 java.lang.String keyFor(java.awt.Component c)
          Get the map key for this component's value.
abstract  void startListeningTo(java.awt.Component c, WizardPage.CustomComponentNotifier n)
          Begin listening for events on the component.
abstract  void stopListeningTo(java.awt.Component c)
          Stop listening for events on a component.
abstract  java.lang.Object valueFor(java.awt.Component c)
          Get the value currently set on the passed component.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WizardPage.CustomComponentListener

public WizardPage.CustomComponentListener()
Method Detail

accept

public abstract boolean accept(java.awt.Component c)
Indicates that this CustomComponentListener will take responsibility for noticing events from the passed component, and that the WizardPage should not try to automatically listen on it (which it can only do for standard Swing components and their children).

Note that this method may be called frequently and any test it does should be fast.

Important: The return value from this method should always be the same for any given component, for the lifetime of the WizardPage.

Parameters:
c - A component
Returns:
Whether or not this CustomComponentListener will listen on the passed component. If true, the component will later be passed to startListeningTo()

startListeningTo

public abstract void startListeningTo(java.awt.Component c,
                                      WizardPage.CustomComponentNotifier n)
Begin listening for events on the component. When an event occurs, call the eventOccurred() method on the passed CustomComponentNotifier.

Parameters:
c - The component to start listening to
n - An object that can be called to update the settings map when an interesting event occurs on the component

stopListeningTo

public abstract void stopListeningTo(java.awt.Component c)
Stop listening for events on a component.

Parameters:
c - The component to stop listening to

isContainer

public boolean isContainer(java.awt.Component c)
Determine if the passed component is a container whose children may need to be listened on. Returns false by default.

Parameters:
c - A component which might be a container

keyFor

public java.lang.String keyFor(java.awt.Component c)
Get the map key for this component's value. By default, returns the component's name. Will only be passed components which the accept() method returned true for.

Important: The return value from this method should always be the same for any given component, for the lifetime of the WizardPage.

Parameters:
c - the component, which the accept method earlier returned true for
Returns:
A string key that should be used in the Wizard's settings map for the name of this component's value

valueFor

public abstract java.lang.Object valueFor(java.awt.Component c)
Get the value currently set on the passed component. Will only be passed components which the accept() method returned true for, and which keyFor() returned non-null.

Parameters:
c - the component
Returns:
An object representing the current value of this component. For example, if it were a JTextComponent, the value would likely be the return value of JTextComponent.getText()