summaryrefslogtreecommitdiffstats
path: root/src/com/vaadin/ui/Button.java
diff options
context:
space:
mode:
authorArtur Signell <artur@vaadin.com>2012-04-02 22:23:51 +0300
committerArtur Signell <artur@vaadin.com>2012-04-05 00:08:13 +0300
commitf57bb5da8cb10a7dec5184fdf615424a34138447 (patch)
tree1d46d31724a79dd2f824b8fd6f629b06f4196fab /src/com/vaadin/ui/Button.java
parentc9280bc5736184410602530313a884a4c7dc540f (diff)
downloadvaadin-framework-f57bb5da8cb10a7dec5184fdf615424a34138447.tar.gz
vaadin-framework-f57bb5da8cb10a7dec5184fdf615424a34138447.zip
Defined RPC in a field rather than inline for clarity
Diffstat (limited to 'src/com/vaadin/ui/Button.java')
-rw-r--r--src/com/vaadin/ui/Button.java25
1 files changed, 13 insertions, 12 deletions
diff --git a/src/com/vaadin/ui/Button.java b/src/com/vaadin/ui/Button.java
index fc564c3237..daa7e20ca7 100644
--- a/src/com/vaadin/ui/Button.java
+++ b/src/com/vaadin/ui/Button.java
@@ -38,22 +38,23 @@ public class Button extends AbstractComponent implements
FieldEvents.BlurNotifier, FieldEvents.FocusNotifier, Focusable,
Action.ShortcutNotifier {
+ private ButtonServerRpc rpc = new ButtonServerRpc() {
+ public void click(MouseEventDetails mouseEventDetails) {
+ fireClick(mouseEventDetails);
+ }
+
+ public void disableOnClick() {
+ // Could be optimized so the button is not repainted because of
+ // this (client side has already disabled the button)
+ setEnabled(false);
+ }
+ };
+
/**
* Creates a new push button.
*/
public Button() {
- // TODO take the implementation out of an anonymous class?
- registerRpcImplementation(new ButtonServerRpc() {
- public void click(MouseEventDetails mouseEventDetails) {
- fireClick(mouseEventDetails);
- }
-
- public void disableOnClick() {
- // Could be optimized so the button is not repainted because of
- // this (client side has already disabled the button)
- setEnabled(false);
- }
- }, ButtonServerRpc.class);
+ registerRpcImplementation(rpc, ButtonServerRpc.class);
}
/**