Revision afd3a0ef src/gr/ebs/gss/client/DeleteUserDialog.java
b/src/gr/ebs/gss/client/DeleteUserDialog.java | ||
---|---|---|
24 | 24 |
import gr.ebs.gss.client.rest.resource.GroupUserResource; |
25 | 25 |
|
26 | 26 |
import com.google.gwt.core.client.GWT; |
27 |
import com.google.gwt.dom.client.NativeEvent; |
|
28 |
import com.google.gwt.event.dom.client.ClickEvent; |
|
29 |
import com.google.gwt.event.dom.client.ClickHandler; |
|
30 |
import com.google.gwt.event.dom.client.KeyCodes; |
|
27 | 31 |
import com.google.gwt.user.client.DeferredCommand; |
32 |
import com.google.gwt.user.client.Event.NativePreviewEvent; |
|
33 |
import com.google.gwt.user.client.ui.AbstractImagePrototype; |
|
28 | 34 |
import com.google.gwt.user.client.ui.Button; |
29 |
import com.google.gwt.user.client.ui.ClickListener; |
|
30 | 35 |
import com.google.gwt.user.client.ui.DialogBox; |
31 | 36 |
import com.google.gwt.user.client.ui.HTML; |
32 | 37 |
import com.google.gwt.user.client.ui.HasHorizontalAlignment; |
33 | 38 |
import com.google.gwt.user.client.ui.HorizontalPanel; |
34 |
import com.google.gwt.user.client.ui.KeyboardListener; |
|
35 | 39 |
import com.google.gwt.user.client.ui.TreeItem; |
36 | 40 |
import com.google.gwt.user.client.ui.VerticalPanel; |
37 |
import com.google.gwt.user.client.ui.Widget; |
|
38 | 41 |
|
39 | 42 |
|
40 | 43 |
/** |
... | ... | |
59 | 62 |
|
60 | 63 |
// Create the 'about' text and set a style name so we can style it with |
61 | 64 |
// CSS. |
62 |
final HTML text = new HTML("<table><tr><td>" + images.warn().getHTML() + "</td><td>" + "Are you sure you want to remove user '" + group.getName() + "'?</td></tr></table>");
|
|
65 |
final HTML text = new HTML("<table><tr><td>" + AbstractImagePrototype.create(images.warn()).getHTML() + "</td><td>" + "Are you sure you want to remove user '" + group.getName() + "'?</td></tr></table>");
|
|
63 | 66 |
text.setStyleName("gss-warnMessage"); |
64 | 67 |
outer.add(text); |
65 | 68 |
|
66 | 69 |
// Create the 'Quit' button, along with a listener that hides the dialog |
67 | 70 |
// when the button is clicked and quits the application. |
68 |
final Button ok = new Button("OK", new ClickListener() {
|
|
69 |
|
|
70 |
public void onClick(Widget sender) {
|
|
71 |
final Button ok = new Button("OK", new ClickHandler() {
|
|
72 |
@Override |
|
73 |
public void onClick(ClickEvent event) {
|
|
71 | 74 |
deleteUser(); |
72 | 75 |
hide(); |
73 | 76 |
} |
... | ... | |
77 | 80 |
// Create the 'Cancel' button, along with a listener that hides the |
78 | 81 |
// dialog |
79 | 82 |
// when the button is clicked. |
80 |
final Button cancel = new Button("Cancel", new ClickListener() {
|
|
81 |
|
|
82 |
public void onClick(Widget sender) {
|
|
83 |
final Button cancel = new Button("Cancel", new ClickHandler() {
|
|
84 |
@Override |
|
85 |
public void onClick(ClickEvent event) {
|
|
83 | 86 |
hide(); |
84 | 87 |
} |
85 | 88 |
}); |
... | ... | |
135 | 138 |
} |
136 | 139 |
|
137 | 140 |
@Override |
138 |
public boolean onKeyDownPreview(final char key, final int modifiers) { |
|
141 |
protected void onPreviewNativeEvent(NativePreviewEvent preview) { |
|
142 |
super.onPreviewNativeEvent(preview); |
|
143 |
|
|
144 |
NativeEvent evt = preview.getNativeEvent(); |
|
145 |
if (evt.getType().equals("keydown")) |
|
139 | 146 |
// Use the popup's key preview hooks to close the dialog when either |
140 | 147 |
// enter or escape is pressed. |
141 |
switch (key) {
|
|
142 |
case KeyboardListener.KEY_ENTER:
|
|
148 |
switch (evt.getKeyCode()) {
|
|
149 |
case KeyCodes.KEY_ENTER:
|
|
143 | 150 |
hide(); |
144 | 151 |
deleteUser(); |
145 | 152 |
break; |
146 |
case KeyboardListener.KEY_ESCAPE:
|
|
153 |
case KeyCodes.KEY_ESCAPE:
|
|
147 | 154 |
hide(); |
148 | 155 |
break; |
149 | 156 |
} |
150 |
|
|
151 |
return true; |
|
152 | 157 |
} |
153 | 158 |
|
154 | 159 |
} |
Also available in: Unified diff