public class EditorHelper
extends java.lang.Object
Constructor and Description |
---|
EditorHelper(DocumentNode node,
java.util.function.Consumer<java.lang.Object> updateUiFromNodeValue) |
Modifier and Type | Method and Description |
---|---|
void |
destroy()
Removes node listeners
|
boolean |
isUpdatingUi()
Can be checked to prevent UI listeners from updating the node's value.
|
java.awt.event.ItemListener |
newItemListener(java.util.function.Consumer<java.lang.Boolean> realListener)
Convenience function that makes an ItemListener that will automatically ignore events while the updatingUi
flag is set.
|
void |
setValue(java.lang.Object value)
Sets the value in such a way that the resulting value change event won't re-trigger the ui to update.
|
void |
updateUi(java.lang.Runnable r)
Any code that updates the UI should be put through here, that way the updating flag can be set and then
used to prevent other ui listeners from firing.
|
public EditorHelper(DocumentNode node, java.util.function.Consumer<java.lang.Object> updateUiFromNodeValue)
updateUiFromNodeValue
- Called when the node's value changes. Update the UI here. will automatically be
called inside the updateUI wrapper.public void destroy()
public java.awt.event.ItemListener newItemListener(java.util.function.Consumer<java.lang.Boolean> realListener)
public boolean isUpdatingUi()
public void setValue(java.lang.Object value)
public void updateUi(java.lang.Runnable r)