Class Listen
- java.lang.Object
-
- com.inductiveautomation.ignition.client.util.gui.Listen
-
public class Listen extends java.lang.Object
Utility class to adapt classic swing listener patterns to a more Java-8 style of code.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Listen.PopupMenuAdapter
-
Constructor Summary
Constructors Constructor Description Listen()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
toAction(javax.swing.AbstractButton button, java.lang.Runnable r)
static void
toAction(javax.swing.JTextField field, java.lang.Runnable r)
static <T> void
toCombobox(javax.swing.JComboBox<T> combobox, java.util.function.Consumer<T> listener)
static Listen.PopupMenuAdapter
toComboboxPopup(javax.swing.JComboBox<?> menu)
static void
toDisplayable(javax.swing.JComponent component, java.util.function.Consumer<java.lang.Boolean> onChange)
Listens to when a component is added into or removed from the component hierarchy, changing it's displayable flag.static void
toDocumentChange(javax.swing.text.Document document, java.util.function.Consumer<java.lang.String> onChange)
Will be called any time a document changes, and will deliver the new text of the document to the provided listenerstatic void
toDocumentChange(javax.swing.text.JTextComponent component, java.util.function.Consumer<java.lang.String> onChange)
Will be called any time a document changes, and will deliver the new text of the document to the provided listenerstatic void
toDoubleClick(javax.swing.JComponent component, java.lang.Runnable r)
static void
toDoubleClick(javax.swing.JComponent component, java.util.function.Consumer<java.awt.event.MouseEvent> r)
static void
toFocusGained(java.awt.Component component, java.lang.Runnable r)
static void
toFocusLost(java.awt.Component component, java.lang.Runnable r)
static void
toKeyEvents(javax.swing.JTextField textField, java.awt.event.KeyAdapter keyAdapter)
static Listen.PopupMenuAdapter
toPopupMenu(com.jidesoft.popup.JidePopup menu)
static Listen.PopupMenuAdapter
toPopupMenu(javax.swing.JPopupMenu menu)
static void
toPopupTrigger(javax.swing.JComponent component, java.lang.Runnable r)
static void
toPopupTrigger(javax.swing.JComponent component, java.util.function.Consumer<java.awt.event.MouseEvent> r)
static void
toPress(javax.swing.JComponent component, java.lang.Runnable r)
static java.lang.Runnable
toProperty(java.awt.Component component, java.lang.String propertyName, java.util.function.Consumer<java.lang.Object> consumer)
static void
toStateChange(java.awt.ItemSelectable checkBox, java.util.function.Consumer<java.lang.Boolean> listener)
-
-
-
Method Detail
-
toProperty
public static java.lang.Runnable toProperty(java.awt.Component component, java.lang.String propertyName, java.util.function.Consumer<java.lang.Object> consumer)
-
toAction
public static void toAction(javax.swing.AbstractButton button, java.lang.Runnable r)
-
toAction
public static void toAction(javax.swing.JTextField field, java.lang.Runnable r)
-
toPress
public static void toPress(javax.swing.JComponent component, java.lang.Runnable r)
-
toDoubleClick
public static void toDoubleClick(javax.swing.JComponent component, java.lang.Runnable r)
-
toDoubleClick
public static void toDoubleClick(javax.swing.JComponent component, java.util.function.Consumer<java.awt.event.MouseEvent> r)
-
toPopupTrigger
public static void toPopupTrigger(javax.swing.JComponent component, java.lang.Runnable r)
-
toPopupTrigger
public static void toPopupTrigger(javax.swing.JComponent component, java.util.function.Consumer<java.awt.event.MouseEvent> r)
-
toStateChange
public static void toStateChange(java.awt.ItemSelectable checkBox, java.util.function.Consumer<java.lang.Boolean> listener)
-
toCombobox
public static <T> void toCombobox(javax.swing.JComboBox<T> combobox, java.util.function.Consumer<T> listener)
-
toFocusGained
public static void toFocusGained(java.awt.Component component, java.lang.Runnable r)
-
toFocusLost
public static void toFocusLost(java.awt.Component component, java.lang.Runnable r)
-
toDocumentChange
public static void toDocumentChange(javax.swing.text.JTextComponent component, java.util.function.Consumer<java.lang.String> onChange)
Will be called any time a document changes, and will deliver the new text of the document to the provided listener
-
toDocumentChange
public static void toDocumentChange(javax.swing.text.Document document, java.util.function.Consumer<java.lang.String> onChange)
Will be called any time a document changes, and will deliver the new text of the document to the provided listener
-
toDisplayable
public static void toDisplayable(javax.swing.JComponent component, java.util.function.Consumer<java.lang.Boolean> onChange)
Listens to when a component is added into or removed from the component hierarchy, changing it's displayable flag.
-
toKeyEvents
public static void toKeyEvents(javax.swing.JTextField textField, java.awt.event.KeyAdapter keyAdapter)
-
toPopupMenu
public static Listen.PopupMenuAdapter toPopupMenu(com.jidesoft.popup.JidePopup menu)
-
toPopupMenu
public static Listen.PopupMenuAdapter toPopupMenu(javax.swing.JPopupMenu menu)
-
toComboboxPopup
public static Listen.PopupMenuAdapter toComboboxPopup(javax.swing.JComboBox<?> menu)
-
-