The properties live in jabgui, and the marshalling is the reason: JavaFX properties are just
observable values and need no toolkit, but hopping to the JavaFX thread does, and a manager
that hops on every push cannot record a change in a plain unit test — it throws "Toolkit not
initialized". Only an observer that feeds the UI needs the hop, so it lives with the observer
while JabRefUndoManager stays plain Java.
Extends rather than wraps, following JabRefGuiPreferences extends JabRefCliPreferences.
Wrapping meant every caller reached through a getUndoManager() accessor to do anything, and
meant two objects where the application only ever has one.
| Modifier and Type | Field and Description |
|---|---|
| private final ReadOnlyBooleanWrapper | |
| private final ReadOnlyBooleanWrapper | |
| private final ReadOnlyBooleanWrapper |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public ReadOnlyBooleanProperty | hasChangedProperty()
Implements org. Whether the library differs from the last saved position. |
| public ReadOnlyBooleanProperty | redoableProperty()
Implements org. Whether there is anything to redo. |
| private void | refresh()
Reads the stacks on the JavaFX thread rather than where the notification arrived, so that what is written is what the journal holds at the moment of writing. |
| public ReadOnlyBooleanProperty | undoableProperty()
Implements org. Whether there is anything to undo, for binding menu and toolbar enablement. |
| changed | back to summary |
|---|---|
| private final ReadOnlyBooleanWrapper changed | |
| redoable | back to summary |
|---|---|
| private final ReadOnlyBooleanWrapper redoable | |
| undoable | back to summary |
|---|---|
| private final ReadOnlyBooleanWrapper undoable | |
| JabRefGuiUndoManager | back to summary |
|---|---|
| public JabRefGuiUndoManager() | |
| hasChangedProperty | back to summary |
|---|---|
| public ReadOnlyBooleanProperty hasChangedProperty() Implements org. Doc from org. Whether the library differs from the last saved position.
| |
| redoableProperty | back to summary |
|---|---|
| public ReadOnlyBooleanProperty redoableProperty() Implements org. Doc from org. Whether there is anything to redo.
| |
| refresh | back to summary |
|---|---|
| private void refresh() Reads the stacks on the JavaFX thread rather than where the notification arrived, so that what is written is what the journal holds at the moment of writing. Reading first and carrying the values over would let a thread that read an older state post after one that read a newer state, leaving the menu enabled over an empty stack until the next edit. Applied inline when the edit was already made on the JavaFX thread, so a caller that records a change and then reads the property in the same event does not see the previous value. Deferring unconditionally would leave the menu stale for a pulse. A burst of edits off the JavaFX thread therefore queues one update per edit, uncoalesced. That costs queue pressure and nothing else: each update reads the current state, so every one after the first sets the value already there, which a JavaFX property ignores without notifying anything. The burst worth worrying about was one push per keystroke, and typing is one step now; a command pushes once, however long it ran. | |
| undoableProperty | back to summary |
|---|---|
| public ReadOnlyBooleanProperty undoableProperty() Implements org. Doc from org. Whether there is anything to undo, for binding menu and toolbar enablement.
| |