|
@@ -16,26 +16,24 @@ |
16 |
16 |
|
* the License. |
17 |
17 |
|
*/ |
18 |
18 |
|
|
19 |
|
- |
import java.util.*; |
20 |
|
- |
|
21 |
19 |
|
import com.google.gwt.user.client.*; |
22 |
20 |
|
import com.google.gwt.user.client.ui.*; |
23 |
21 |
|
|
|
22 |
+ |
import java.util.*; |
|
23 |
+ |
|
24 |
24 |
|
/** |
25 |
25 |
|
* Wraps an widget to provide event processing via |
26 |
26 |
|
* {@link asquare.gwt.tk.client.ui.behavior.Controller controllers}. The |
27 |
27 |
|
* wrapped widget will process events and notify listeners as if it was not |
28 |
28 |
|
* wrapped. |
29 |
29 |
|
*/ |
30 |
|
- |
public class CWrapper extends EventWrapper implements ControllerSupport |
31 |
|
- |
{ |
|
30 |
+ |
public class CWrapper extends EventWrapper implements ControllerSupport { |
32 |
31 |
|
private final ControllerSupportDelegate m_controllerSupport; |
33 |
32 |
|
|
34 |
33 |
|
/** |
35 |
34 |
|
* Creates a CWrapper around the specified widget. |
36 |
35 |
|
*/ |
37 |
|
- |
public CWrapper( Widget widget ) |
38 |
|
- |
{ |
|
36 |
+ |
public CWrapper( Widget widget ) { |
39 |
37 |
|
this( widget, null ); |
40 |
38 |
|
} |
41 |
39 |
|
|
|
@@ -48,13 +46,11 @@ |
48 |
46 |
|
* |
49 |
47 |
|
* @throws IllegalArgumentException if <code>element</code> is null |
50 |
48 |
|
*/ |
51 |
|
- |
public CWrapper( Widget widget, List controllers ) |
52 |
|
- |
{ |
|
49 |
+ |
public CWrapper( Widget widget, List controllers ) { |
53 |
50 |
|
initWidget( widget ); |
54 |
51 |
|
m_controllerSupport = new ControllerSupportDelegate( this ); |
55 |
52 |
|
|
56 |
|
- |
if ( controllers == null ) |
57 |
|
- |
{ |
|
53 |
+ |
if ( controllers == null ) { |
58 |
54 |
|
controllers = createControllers(); |
59 |
55 |
|
} |
60 |
56 |
|
|
|
@@ -67,8 +63,7 @@ |
67 |
63 |
|
* |
68 |
64 |
|
* @return a List with 0 or more controllers, or <code>null</code> |
69 |
65 |
|
*/ |
70 |
|
- |
protected List createControllers() |
71 |
|
- |
{ |
|
66 |
+ |
protected List createControllers() { |
72 |
67 |
|
return null; |
73 |
68 |
|
} |
74 |
69 |
|
|
|
@@ -77,8 +72,7 @@ |
77 |
72 |
|
* @see asquare.gwt.tk.client.ui.behavior.ControllerSupport#getController(java.lang.Class) |
78 |
73 |
|
*/ |
79 |
74 |
|
@Override |
80 |
|
- |
public Controller getController( Class id ) |
81 |
|
- |
{ |
|
75 |
+ |
public Controller getController( Class id ) { |
82 |
76 |
|
return m_controllerSupport.getController( id ); |
83 |
77 |
|
} |
84 |
78 |
|
|
|
@@ -87,8 +81,7 @@ |
87 |
81 |
|
* @see asquare.gwt.tk.client.ui.behavior.ControllerSupport#addController(asquare.gwt.tk.client.ui.behavior.Controller) |
88 |
82 |
|
*/ |
89 |
83 |
|
@Override |
90 |
|
- |
public Widget addController( Controller controller ) |
91 |
|
- |
{ |
|
84 |
+ |
public Widget addController( Controller controller ) { |
92 |
85 |
|
return m_controllerSupport.addController( controller ); |
93 |
86 |
|
} |
94 |
87 |
|
|
|
@@ -97,8 +90,7 @@ |
97 |
90 |
|
* @see asquare.gwt.tk.client.ui.behavior.ControllerSupport#removeController(asquare.gwt.tk.client.ui.behavior.Controller) |
98 |
91 |
|
*/ |
99 |
92 |
|
@Override |
100 |
|
- |
public Widget removeController( Controller controller ) |
101 |
|
- |
{ |
|
93 |
+ |
public Widget removeController( Controller controller ) { |
102 |
94 |
|
return m_controllerSupport.removeController( controller ); |
103 |
95 |
|
} |
104 |
96 |
|
|
|
@@ -107,8 +99,7 @@ |
107 |
99 |
|
* @see asquare.gwt.tk.client.ui.behavior.ControllerSupport#setControllers(java.util.List) |
108 |
100 |
|
*/ |
109 |
101 |
|
@Override |
110 |
|
- |
public void setControllers( List controllers ) |
111 |
|
- |
{ |
|
102 |
+ |
public void setControllers( List controllers ) { |
112 |
103 |
|
m_controllerSupport.setControllers( controllers ); |
113 |
104 |
|
} |
114 |
105 |
|
|
|
@@ -117,8 +108,7 @@ |
117 |
108 |
|
* @see com.google.gwt.user.client.ui.UIObject#sinkEvents(int) |
118 |
109 |
|
*/ |
119 |
110 |
|
@Override |
120 |
|
- |
public void sinkEvents( int eventBits ) |
121 |
|
- |
{ |
|
111 |
+ |
public void sinkEvents( int eventBits ) { |
122 |
112 |
|
m_controllerSupport.sinkEvents( eventBits ); |
123 |
113 |
|
} |
124 |
114 |
|
|
|
@@ -127,8 +117,7 @@ |
127 |
117 |
|
* @see com.google.gwt.user.client.ui.UIObject#unsinkEvents(int) |
128 |
118 |
|
*/ |
129 |
119 |
|
@Override |
130 |
|
- |
public void unsinkEvents( int eventBits ) |
131 |
|
- |
{ |
|
120 |
+ |
public void unsinkEvents( int eventBits ) { |
132 |
121 |
|
m_controllerSupport.unsinkEvents( eventBits ); |
133 |
122 |
|
} |
134 |
123 |
|
|
|
@@ -137,10 +126,8 @@ |
137 |
126 |
|
* @see com.google.gwt.user.client.ui.Widget#onAttach() |
138 |
127 |
|
*/ |
139 |
128 |
|
@Override |
140 |
|
- |
protected void onAttach() |
141 |
|
- |
{ |
142 |
|
- |
if ( isAttached() ) |
143 |
|
- |
{ |
|
129 |
+ |
protected void onAttach() { |
|
130 |
+ |
if ( isAttached() ) { |
144 |
131 |
|
return; |
145 |
132 |
|
} |
146 |
133 |
|
m_controllerSupport.onAttach(); |
|
@@ -152,19 +139,15 @@ |
152 |
139 |
|
* @see com.google.gwt.user.client.ui.Widget#onDetach() |
153 |
140 |
|
*/ |
154 |
141 |
|
@Override |
155 |
|
- |
protected void onDetach() |
156 |
|
- |
{ |
157 |
|
- |
if ( !isAttached() ) |
158 |
|
- |
{ |
|
142 |
+ |
protected void onDetach() { |
|
143 |
+ |
if ( !isAttached() ) { |
159 |
144 |
|
return; |
160 |
145 |
|
} |
161 |
146 |
|
|
162 |
|
- |
try |
163 |
|
- |
{ |
|
147 |
+ |
try { |
164 |
148 |
|
super.onDetach(); |
165 |
149 |
|
} |
166 |
|
- |
finally |
167 |
|
- |
{ |
|
150 |
+ |
finally { |
168 |
151 |
|
m_controllerSupport.onDetach(); |
169 |
152 |
|
} |
170 |
153 |
|
} |
|
@@ -174,10 +157,8 @@ |
174 |
157 |
|
* @see com.google.gwt.user.client.EventListener#onBrowserEvent(com.google.gwt.user.client.Event) |
175 |
158 |
|
*/ |
176 |
159 |
|
@Override |
177 |
|
- |
public void onBrowserEvent( Event event ) |
178 |
|
- |
{ |
179 |
|
- |
if ( (m_controllerSupport.getLegacyEventBits() & DOM.eventGetType( event )) != 0 ) |
180 |
|
- |
{ |
|
160 |
+ |
public void onBrowserEvent( Event event ) { |
|
161 |
+ |
if ( (m_controllerSupport.getLegacyEventBits() & DOM.eventGetType( event )) != 0 ) { |
181 |
162 |
|
super.onBrowserEvent( event ); |
182 |
163 |
|
} |
183 |
164 |
|
m_controllerSupport.onBrowserEvent( event ); |