public class EditorManager
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
PROPERTY_EDITOR_MANAGER |
| Constructor and Description |
|---|
EditorManager() |
| Modifier and Type | Method and Description |
|---|---|
void |
clear() |
static EditorManager |
createInstance()
Creates a new instance of the EditorManager.
|
Editor |
getEditor(java.lang.Class<?> clazz)
Gets the registered editor using default context.
|
Editor |
getEditor(java.lang.Class<?> clazz,
EditorContext context)
Gets the registered editor.
|
EditorContext[] |
getEditorContexts(java.lang.Class<?> clazz)
Gets the available EditorContext registered with the class.
|
static EditorManager |
getInstance()
Gets the default instance of the EditorManager.
|
static EditorManager |
getInstance(javafx.scene.Node node)
Gets the EditorManager from the node if the node has an EditorManager defined on the Properties.
|
void |
initDefaultEditors()
Initial the default editors.
|
boolean |
isAutoInit()
Checks the value of autoInit.
|
void |
registerEditor(java.lang.Class<?> clazz,
java.util.function.Supplier<Editor> editorFactory)
Registers an editor with a class and default context.
|
void |
registerEditor(java.lang.Class<?> clazz,
java.util.function.Supplier<Editor> editorFactory,
EditorContext context)
Registers a editor with a class and a context.
|
void |
resetInit()
If
initDefaultEditors() is called once, calling it again will have no effect because an internal flag is
set. |
void |
setAutoInit(boolean autoInit)
Sets autoInit to true or false.
|
void |
unregisterAllEditors()
Unregisters all the editors which registered before.
|
void |
unregisterAllEditors(java.lang.Class<?> clazz)
Unregisters all editors which register with the class.
|
void |
unregisterEditor(java.lang.Class<?> clazz,
EditorContext context)
Unregisters the editor which registers with the class and the context.
|
public static final java.lang.String PROPERTY_EDITOR_MANAGER
public static EditorManager createInstance()
public static EditorManager getInstance()
public static EditorManager getInstance(javafx.scene.Node node)
node - the nodepublic void registerEditor(java.lang.Class<?> clazz,
java.util.function.Supplier<Editor> editorFactory,
EditorContext context)
clazz - the typeeditorFactory - the editor factorycontext - the editor contextpublic void registerEditor(java.lang.Class<?> clazz,
java.util.function.Supplier<Editor> editorFactory)
clazz - the typeeditorFactory - the editor factorypublic void unregisterEditor(java.lang.Class<?> clazz,
EditorContext context)
clazz - the type of which the editor will be unregistered.context - the editor context.public void unregisterAllEditors(java.lang.Class<?> clazz)
clazz - the type of which the editor will be unregistered.public void unregisterAllEditors()
public Editor getEditor(java.lang.Class<?> clazz, EditorContext context)
clazz - the type.context - the editor context.public Editor getEditor(java.lang.Class<?> clazz)
clazz - the type.public boolean isAutoInit()
setAutoInit(boolean)public void setAutoInit(boolean autoInit)
initDefaultEditors() will be called if it has never be called. By default, autoInit is true.
This might affect the behavior if users provide their own Editors and want to overwrite default Editors.
In this case, instead of depending on autoInit to initialize default Editors, you should call initDefaultEditors() first, then call registerEditor to add your own Editors.
autoInit - true or false.public EditorContext[] getEditorContexts(java.lang.Class<?> clazz)
clazz - the class.public void initDefaultEditors()
public void resetInit()
initDefaultEditors() is called once, calling it again will have no effect because an internal flag is
set. This method will reset the internal flag so that you can call initDefaultEditors() in case you
unregister all editors using unregisterAllEditors().public void clear()