// Path: GridFastNavigation-addon/src/main/java/org/vaadin/patrik/client/SpinLock.java
// public interface Callback {
//     void complete();
// }
// 
// Path: GridFastNavigation-addon/src/main/java/org/vaadin/patrik/client/SpinLock.java
// public interface LockFunction {
//     boolean execute();
// }
// 
// Path: GridFastNavigation-addon/src/main/java/org/vaadin/patrik/shared/FastNavigationState.java
// @SuppressWarnings("serial")
// public class FastNavigationState extends SharedState {
//     
//     public boolean openEditorOnType = true;
//     
//     public boolean selectTextOnEditorOpen = true;
// 
//     public boolean allowTabRowChange = true;
//     
//     public boolean allowArrowRowChange = true;
//     
//     public boolean changeColumnAfterLastRow = false;
//     
//     public boolean hasFocusListener = false;
//     
//     public boolean hasRowFocusListener = false;
//     
//     public boolean hasCellFocusListener = false;
//     
//     public boolean hasRowEditListener = false;
//     
//     public boolean hasCellEditListener = false;
//     
//     public boolean hasEditorOpenListener = false;
//     
//     public boolean hasEditorMoveListener = false;
//     
//     public boolean hasEditorCloseListener = false;
//     
//     public boolean hasClickOutListener = false;
//     
//     public boolean changeColumnOnEnter = false;
//     
//     public boolean openEditorWithSingleClick = true;
//     
//     public boolean dispatchEditEventOnBlur  = false;
//     
//     public boolean saveWithCtrlS = false;
//     
//     public boolean rowValidation = false;
//     
//     public boolean homeEndEnabled = true;
//     
//     public boolean enableSelectedStyle = false;
//     
//     public Set<Integer> openShortcuts = new HashSet<Integer>();
//     
//     public Set<Integer> closeShortcuts = new HashSet<Integer>();
// 
//     public Set<Integer> saveShortcuts = new HashSet<Integer>();
// 
// }


import java.util.ArrayList;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.vaadin.patrik.client.SpinLock.Callback;
import org.vaadin.patrik.client.SpinLock.LockFunction;
import org.vaadin.patrik.shared.FastNavigationState;
import com.google.gwt.animation.client.AnimationScheduler;
import com.google.gwt.animation.client.AnimationScheduler.AnimationCallback;
import com.google.gwt.core.client.Scheduler;
import com.google.gwt.dom.client.DivElement;
import com.google.gwt.dom.client.Document;
import com.google.gwt.dom.client.Element;
import com.google.gwt.dom.client.EventTarget;
import com.google.gwt.dom.client.NativeEvent;
import com.google.gwt.dom.client.Style.Position;
import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.event.dom.client.KeyCodes;
import com.google.gwt.event.dom.client.KeyDownEvent;
import com.google.gwt.event.dom.client.KeyDownHandler;
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.Event;
import com.google.gwt.user.client.EventListener;
import com.google.gwt.user.client.ui.Widget;
import com.vaadin.client.WidgetUtil;
import com.vaadin.client.ui.FocusUtil;
import com.vaadin.client.ui.VOverlay;
import com.vaadin.client.widget.grid.DefaultEditorEventHandler;
import com.vaadin.client.widget.grid.EventCellReference;
import com.vaadin.client.widgets.Grid;
import com.vaadin.client.widgets.Grid.Column;
import com.vaadin.client.widgets.Grid.Editor;
import com.vaadin.client.widgets.Grid.EditorDomEvent;
import com.vaadin.event.ShortcutAction.KeyCode;
    // EditorStateManager
    //

    private Set<EditorListener> editorListeners = new LinkedHashSet<EditorListener>();
    
    private Element curtain;
    private Grid<Object> grid;
    private Grid.Editor<Object> editor;
    
    private List<Character> keybuf = new ArrayList<Character>();
    private Set<Integer> openShortcuts = new LinkedHashSet<Integer>();
    private Set<Integer> closeShortcuts = new LinkedHashSet<Integer>();
    private Set<Integer> saveShortcuts = new LinkedHashSet<Integer>();
    private Set<Integer> disabledColumns = new HashSet<Integer>();

    private RPCLock externalLocks;
    private boolean waitingForEditorOpen = false;
    private boolean useExternalLocking = false;
    
    private boolean openEditorOnType = true;
    private boolean openEditorWithSingleClick = true;
    private boolean allowTabRowChange = true;
    private boolean allowArrowRowChange = true;
    private boolean selectTextOnFocus = true;
    private boolean tabWrapping = true;
    private boolean changeColumnAfterLastRow = false;
    private boolean saveWithCtrlS = false;
	private boolean clickOutListenerAdded = false;
	private boolean rowValidation = false;
	private boolean homeEndEnabled = true;
// Path: GridFastNavigation-addon/src/main/java/org/vaadin/patrik/client/SpinLock.java
// public interface Callback {
//     void complete();
// }
// 
// Path: GridFastNavigation-addon/src/main/java/org/vaadin/patrik/client/SpinLock.java
// public interface LockFunction {
//     boolean execute();
// }
// 
// Path: GridFastNavigation-addon/src/main/java/org/vaadin/patrik/shared/FastNavigationState.java
// @SuppressWarnings("serial")
// public class FastNavigationState extends SharedState {
//     
//     public boolean openEditorOnType = true;
//     
//     public boolean selectTextOnEditorOpen = true;
// 
//     public boolean allowTabRowChange = true;
//     
//     public boolean allowArrowRowChange = true;
//     
//     public boolean changeColumnAfterLastRow = false;
//     
//     public boolean hasFocusListener = false;
//     
//     public boolean hasRowFocusListener = false;
//     
//     public boolean hasCellFocusListener = false;
//     
//     public boolean hasRowEditListener = false;
//     
//     public boolean hasCellEditListener = false;
//     
//     public boolean hasEditorOpenListener = false;
//     
//     public boolean hasEditorMoveListener = false;
//     
//     public boolean hasEditorCloseListener = false;
//     
//     public boolean hasClickOutListener = false;
//     
//     public boolean changeColumnOnEnter = false;
//     
//     public boolean openEditorWithSingleClick = true;
//     
//     public boolean dispatchEditEventOnBlur  = false;
//     
//     public boolean saveWithCtrlS = false;
//     
//     public boolean rowValidation = false;
//     
//     public boolean homeEndEnabled = true;
//     
//     public boolean enableSelectedStyle = false;
//     
//     public Set<Integer> openShortcuts = new HashSet<Integer>();
//     
//     public Set<Integer> closeShortcuts = new HashSet<Integer>();
// 
//     public Set<Integer> saveShortcuts = new HashSet<Integer>();
// 
// }


// Path: GridFastNavigation-addon/src/main/java/org/vaadin/patrik/client/EditorStateManager.java
import java.util.ArrayList;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.vaadin.patrik.client.SpinLock.Callback;
import org.vaadin.patrik.client.SpinLock.LockFunction;
import org.vaadin.patrik.shared.FastNavigationState;
import com.google.gwt.animation.client.AnimationScheduler;
import com.google.gwt.animation.client.AnimationScheduler.AnimationCallback;
import com.google.gwt.core.client.Scheduler;
import com.google.gwt.dom.client.DivElement;
import com.google.gwt.dom.client.Document;
import com.google.gwt.dom.client.Element;
import com.google.gwt.dom.client.EventTarget;
import com.google.gwt.dom.client.NativeEvent;
import com.google.gwt.dom.client.Style.Position;
import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.event.dom.client.KeyCodes;
import com.google.gwt.event.dom.client.KeyDownEvent;
import com.google.gwt.event.dom.client.KeyDownHandler;
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.Event;
import com.google.gwt.user.client.EventListener;
import com.google.gwt.user.client.ui.Widget;
import com.vaadin.client.WidgetUtil;
import com.vaadin.client.ui.FocusUtil;
import com.vaadin.client.ui.VOverlay;
import com.vaadin.client.widget.grid.DefaultEditorEventHandler;
import com.vaadin.client.widget.grid.EventCellReference;
import com.vaadin.client.widgets.Grid;
import com.vaadin.client.widgets.Grid.Column;
import com.vaadin.client.widgets.Grid.Editor;
import com.vaadin.client.widgets.Grid.EditorDomEvent;
import com.vaadin.event.ShortcutAction.KeyCode;

    // EditorStateManager
    //

    private Set<EditorListener> editorListeners = new LinkedHashSet<EditorListener>();
    
    private Element curtain;
    private Grid<Object> grid;
    private Grid.Editor<Object> editor;
    
    private List<Character> keybuf = new ArrayList<Character>();
    private Set<Integer> openShortcuts = new LinkedHashSet<Integer>();
    private Set<Integer> closeShortcuts = new LinkedHashSet<Integer>();
    private Set<Integer> saveShortcuts = new LinkedHashSet<Integer>();
    private Set<Integer> disabledColumns = new HashSet<Integer>();

    private RPCLock externalLocks;
    private boolean waitingForEditorOpen = false;
    private boolean useExternalLocking = false;
    
    private boolean openEditorOnType = true;
    private boolean openEditorWithSingleClick = true;
    private boolean allowTabRowChange = true;
    private boolean allowArrowRowChange = true;
    private boolean selectTextOnFocus = true;
    private boolean tabWrapping = true;
    private boolean changeColumnAfterLastRow = false;
    private boolean saveWithCtrlS = false;
	private boolean clickOutListenerAdded = false;
	private boolean rowValidation = false;
	private boolean homeEndEnabled = true;
	private FastNavigationState state;