import gr.ebs.gss.client.rest.resource.FolderResource;\r
\r
import com.google.gwt.core.client.GWT;\r
+import com.google.gwt.dom.client.NativeEvent;\r
+import com.google.gwt.event.dom.client.ClickEvent;\r
+import com.google.gwt.event.dom.client.ClickHandler;\r
+import com.google.gwt.event.dom.client.KeyCodes;\r
import com.google.gwt.user.client.DeferredCommand;\r
+import com.google.gwt.user.client.Event.NativePreviewEvent;\r
+import com.google.gwt.user.client.ui.AbstractImagePrototype;\r
import com.google.gwt.user.client.ui.Button;\r
-import com.google.gwt.user.client.ui.ClickListener;\r
import com.google.gwt.user.client.ui.DialogBox;\r
import com.google.gwt.user.client.ui.HTML;\r
import com.google.gwt.user.client.ui.HasHorizontalAlignment;\r
import com.google.gwt.user.client.ui.HorizontalPanel;\r
-import com.google.gwt.user.client.ui.KeyboardListener;\r
import com.google.gwt.user.client.ui.TreeItem;\r
import com.google.gwt.user.client.ui.VerticalPanel;\r
-import com.google.gwt.user.client.ui.Widget;\r
\r
/**\r
* The 'delete folder' dialog box.\r
VerticalPanel outer = new VerticalPanel();\r
HorizontalPanel buttons = new HorizontalPanel();\r
\r
- HTML text = new HTML("<table><tr><td rowspan='2'>" + images.warn().getHTML() +\r
+ HTML text = new HTML("<table><tr><td rowspan='2'>" + AbstractImagePrototype.create(images.warn()).getHTML() +\r
"</td><td>" + "Are you sure you want to <b>permanently</b> delete folder '" + folder.getName() +\r
"'?</td></tr></table>");\r
text.setStyleName("gss-warnMessage");\r
\r
// Create the 'Delete' button, along with a listener that hides the dialog\r
// when the button is clicked and deletes the folder.\r
- Button ok = new Button("Delete", new ClickListener() {\r
-\r
- public void onClick(Widget sender) {\r
+ Button ok = new Button("Delete", new ClickHandler() {\r
+ @Override\r
+ public void onClick(ClickEvent event) {\r
deleteFolder();\r
hide();\r
}\r
buttons.setCellHorizontalAlignment(ok, HasHorizontalAlignment.ALIGN_CENTER);\r
// Create the 'Cancel' button, along with a listener that hides the\r
// dialog when the button is clicked.\r
- Button cancel = new Button("Cancel", new ClickListener() {\r
-\r
- public void onClick(Widget sender) {\r
+ Button cancel = new Button("Cancel", new ClickHandler() {\r
+ @Override\r
+ public void onClick(ClickEvent event) {\r
hide();\r
}\r
});\r
}\r
\r
@Override\r
- public boolean onKeyDownPreview(final char key, final int modifiers) {\r
- // Use the popup's key preview hooks to close the dialog when either\r
- // enter or escape is pressed.\r
- switch (key) {\r
- case KeyboardListener.KEY_ENTER:\r
- hide();\r
- deleteFolder();\r
- break;\r
- case KeyboardListener.KEY_ESCAPE:\r
- hide();\r
- break;\r
- }\r
- return true;\r
+ protected void onPreviewNativeEvent(NativePreviewEvent preview) {\r
+ super.onPreviewNativeEvent(preview);\r
+\r
+ NativeEvent evt = preview.getNativeEvent();\r
+ if (evt.getType().equals("keydown"))\r
+ // Use the popup's key preview hooks to close the dialog when either\r
+ // enter or escape is pressed.\r
+ switch (evt.getKeyCode()) {\r
+ case KeyCodes.KEY_ENTER:\r
+ hide();\r
+ deleteFolder();\r
+ break;\r
+ case KeyCodes.KEY_ESCAPE:\r
+ hide();\r
+ break;\r
+ }\r
}\r
\r
}\r