private PendingState<T> ensurePendingState() {
        // Create the pending state if needed.
        if (pendingState == null) {
            pendingState = new PendingState<>(state);
        }

        // Schedule a command to resolve the pending state. If a command is
        // already scheduled, we reschedule a new one to ensure that it happens
        // after any existing finally commands (such as SelectionModel
        // commands).
        pendingStateCommand = new ScheduledCommand() {
            @Override
            public void execute() {
                // Verify that this command was the last one scheduled.
                if (pendingStateCommand == this) {
                    resolvePendingState(null);
                }
            }
        };
        scheduleFinally(pendingStateCommand);

        // Return the pending state.
        return pendingState;
    }
Ensure that a pending {@link DefaultState} exists and return it.

@return the pending state
stroom-core-client-widget/src/main/java/com/google/gwt/user/cellview/client/HasDataPresenter.java