Verified Owner
Top Description Fields Constructors Methods
org.jabref.logic.util

public Class CoarseChangeFilter

extends Object
Class Inheritance
Imports
java.util.Optional, org.jabref.model.database.BibDatabaseContext, org.jabref.model.database.event.BibDatabaseContextChangedEvent, org.jabref.model.entry.BibEntry, org.jabref.model.entry.event.FieldChangedEvent, org.jabref.model.entry.field.Field, com.google.common.eventbus.EventBus, .Subscribe, org.slf4j.Logger, .LoggerFactory

Filters change events and only relays major changes.

This asks the same question as org.jabref.logic.undo.CoalescingPolicy — is this change the continuation of a run of typing? — for a different consumer, and the two answers are not interchangeable. The policy decides how much one Ctrl+Z takes back, where being wrong costs a keystroke either way. Here a change marked filtered arms no backup and is held back from the shared database until the next major change (see org.jabref.logic.shared.DBMSSynchronizer), so filtering too eagerly delays what other clients see, while filtering too little only writes a backup more often. That is why this stays with the conservative rule below — a change to another field or entry, or more than one character at once, is major — instead of the policy's contiguity and word rules.

The charactersChangedCount test is a guess at what the caller now says outright: a keystroke records as org.jabref.logic.undo.EditSource#TYPING, everything else as a command. Should the two granularities ever have to agree, that source is the thing to carry into the event, rather than either side re-deriving it.

Field Summary

Modifier and TypeField and Description
private final BibDatabaseContext
private final EventBus
private Optional<BibEntry>
private Optional<Field>
private static final Logger

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public synchronized void
public void
public void
public void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

contextback to summary
private final BibDatabaseContext context
eventBusback to summary
private final EventBus eventBus
lastEntryChangedback to summary
private Optional<BibEntry> lastEntryChanged
lastFieldChangedback to summary
private Optional<Field> lastFieldChanged
LOGGERback to summary
private static final Logger LOGGER

Constructor Detail

CoarseChangeFilterback to summary
public CoarseChangeFilter(BibDatabaseContext bibDatabaseContext)

Method Detail

listenback to summary
public synchronized void listen(BibDatabaseContextChangedEvent event)
Annotations
@Subscribe
registerListenerback to summary
public void registerListener(Object listener)
shutdownback to summary
public void shutdown()
unregisterListenerback to summary
public void unregisterListener(Object listener)