This repository has been archived by the owner on Nov 9, 2017. It is now read-only.
/
CheckKey.java
173 lines (141 loc) · 3.68 KB
/
CheckKey.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
/*
* Copyright 2011, Red Hat, Inc. and individual contributors
* as indicated by the @author tags. See the copyright.txt file in the
* distribution for a full listing of individual contributors.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.zanata.webtrans.client.editor;
import com.google.gwt.dom.client.NativeEvent;
/**
*
* @author Alex Eng <a href="mailto:aeng@redhat.com">aeng@redhat.com</a>
*
* @formatter:off
* Navigation mode:
* ALT+UP arrow or J - Previous entry
* ALT+DOWN arrow or K - Next entry
* ALT+G - copy from source
* Enter - Open editor
*
* Edit mode:
* ALT+(UP arrow/J) - Previous entry
* ALT+(DOWN arrow/K) - Next entry
* ALT+G - copy from source
* CTRL+Enter - Save as approved
* Enter - Save as approved (if isEnterKeySavesEnabled = true)
*
**/
public interface CheckKey
{
static final int KEY_G = 'G';
static final int KEY_J = 'J';
static final int KEY_K = 'K';
static final int KEY_S = 'S';
static int KEY_1 = 49;
static int KEY_1_NUM = 35;
static final int KEY_2 = 50;
static final int KEY_2_NUM = 40;
static final int KEY_3 = 51;
static final int KEY_3_NUM = 34;
static final int KEY_4 = 52;
static final int KEY_4_NUM = 37;
public static enum Context
{
/**
* Edit: InlineTargetCellEditor Navigation: TableEditorPresenter
*/
Navigation, Edit;
}
void init(NativeEvent event);
/**
* Save as fuzzy shortcut: CTRL+S
*/
boolean isSaveAsFuzzyKey();
/**
* Move to previous state entry: ALT+PageUp
*/
boolean isPreviousStateEntryKey();
/**
* Move to next state entry: ALT+PageDown
*/
boolean isNextStateEntryKey();
/**
* Move to previous entry:
* Edit: ALT+(Up/J)
* Navigation: ALT+(Up/J)
*/
boolean isPreviousEntryKey();
/**
* Move to next entry:
* Edit: ALT+(Down/K)
* Navigation: ALT+(Down/K)
*/
boolean isNextEntryKey();
/**
* Copy from source: ALT+G
*
*/
boolean isCopyFromSourceKey();
/**
* Copy from translation memory: CTRL+(1/2/3/4)
*
*/
boolean isCopyFromTransMem();
/**
* User typing in text area, any keys other than ALT+CTRL
*
*/
boolean isUserTyping();
/**
* Close editor: Esc (if isEscKeyCloseEditor = true)
*
*/
boolean isCloseEditorKey(boolean isEscKeyCloseEditor);
/**
* Is ENTER key pressed
*/
boolean isEnterKey();
/**
* Save as approved key:
* CTRL+ENTER or
* ENTER (if isEnterKeySavesEnabled = true AND !shiftKey {Shift+Enter inserts new line})
*
*/
boolean isSaveAsApprovedKey(boolean isEnterKeySavesEnabled);
/**
* Shift key presssed
*/
boolean isShiftKey();
/**
* ALT key presssed
*/
boolean isAltKey();
/**
* Ctrl key presssed
*/
boolean isCtrlKey();
/**
*
* @return pressed key
*/
int getKeyCode();
/**
*
* Backspace key pressed
*/
boolean isBackspace();
}