Class ChangeDetectorCustomizer
- java.lang.Object
-
- io.codeworth.panelmatic.util.customizers.ChangeDetectorCustomizer
-
- All Implemented Interfaces:
PanelMaticComponentCustomizer
public class ChangeDetectorCustomizer extends Object implements PanelMaticComponentCustomizer
Used to detect changes in multiple components. Listeners on this object are notified whenever those changes happen.
This is very useful for, e.g, enabling a "save" button when any of a form controls changes.- Author:
- michael
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceChangeDetectorCustomizer.Listener
-
Constructor Summary
Constructors Constructor Description ChangeDetectorCustomizer()ChangeDetectorCustomizer(ChangeDetectorCustomizer.Listener l)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddListener(ChangeDetectorCustomizer.Listener l)JComponentcustomize(String labelText, JComponent aComp)Customize the component.voidfireChangeEvent(Object originalEvent)ActionListenergetActionListener()ChangeListenergetChangeListener()DocumentListenergetDocumentListener()voidremoveListener(ChangeDetectorCustomizer.Listener l)
-
-
-
Constructor Detail
-
ChangeDetectorCustomizer
public ChangeDetectorCustomizer()
-
ChangeDetectorCustomizer
public ChangeDetectorCustomizer(ChangeDetectorCustomizer.Listener l)
-
-
Method Detail
-
fireChangeEvent
public void fireChangeEvent(Object originalEvent)
-
addListener
public void addListener(ChangeDetectorCustomizer.Listener l)
-
removeListener
public void removeListener(ChangeDetectorCustomizer.Listener l)
-
getActionListener
public ActionListener getActionListener()
- Returns:
- The action listener used to detect changes on combo boxes and toggle buttons.
-
getDocumentListener
public DocumentListener getDocumentListener()
- Returns:
- the listener used to detect changes on text components.
-
getChangeListener
public ChangeListener getChangeListener()
- Returns:
- the listener used to detect changes on JSliders.
-
customize
public JComponent customize(String labelText, JComponent aComp)
Description copied from interface:PanelMaticComponentCustomizerCustomize the component. Note that this method also allows for wrapping the component in a new component, or replacing it altogether.- Specified by:
customizein interfacePanelMaticComponentCustomizer- Parameters:
labelText- the string for the label (ornull). Useful for meta-data, as in adding a tool-tip according to it.aComp- the component to customize- Returns:
- Normally the passed component; could also be a wrapping component or even a new one.
-
-