Subversion Repository Public Repository

litesoft

Diff Revisions 949 vs 950 for /trunk/Java/GWT/Client/src/org/litesoft/GWT/client/widgets/nonpublic/external/EventWrapper.java

Diff revisions: vs.
  @@ -1,77 +1,77 @@
1 - // This Source Code is Copyright & Licenced as indicated below
2 - package org.litesoft.GWT.client.widgets.nonpublic.external;
3 - /*
4 - * Copyright 2006 Mat Gessel <mat.gessel@gmail.com>
5 - *
6 - * Licensed under the Apache License, Version 2.0 (the "License"); you may not
7 - * use this file except in compliance with the License. You may obtain a copy of
8 - * the License at
9 - *
10 - * http://www.apache.org/licenses/LICENSE-2.0
11 - *
12 - * Unless required by applicable law or agreed to in writing, software
13 - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14 - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
15 - * License for the specific language governing permissions and limitations under
16 - * the License.
17 - */
18 -
19 - import com.google.gwt.user.client.*;
20 - import com.google.gwt.user.client.ui.*;
21 -
22 - /**
23 - * A widget wrapper which can process the
24 - * wrapped widget's events.
25 - */
26 - public abstract class EventWrapper extends Composite {
27 - private Widget m_widget;
28 -
29 - /**
30 - * Default constructor for convenience. You will need to call
31 - * {@link #initWidget(Widget)} before calling any {@link Widget} methods.
32 - */
33 - public EventWrapper() {
34 -
35 - }
36 -
37 - public EventWrapper( Widget w, int eventMask ) {
38 - initWidget( w );
39 - sinkEvents( eventMask );
40 - }
41 -
42 - /*
43 - * (non-Javadoc)
44 - * @see com.google.gwt.user.client.ui.Composite#initWidget(com.google.gwt.user.client.ui.Widget)
45 - */
46 - @Override
47 - protected void initWidget( Widget widget ) {
48 - super.initWidget( widget );
49 - m_widget = widget;
50 - }
51 -
52 - @Override
53 - protected Widget getWidget() {
54 - return m_widget;
55 - }
56 -
57 - /*
58 - * (non-Javadoc)
59 - * Hijacks events intended for the wrapped widget's element.
60 - * @see com.google.gwt.user.client.ui.Widget#onAttach()
61 - */
62 - @Override
63 - protected void onAttach() {
64 - super.onAttach();
65 - DOM.setEventListener( getElement(), this );
66 - }
67 -
68 - /**
69 - * Override to process browser events. Don't forget to call super
70 - * implementation if you want the wrapped widget to process events also.
71 - * {@inheritDoc}
72 - */
73 - @Override
74 - public void onBrowserEvent( Event event ) {
75 - m_widget.onBrowserEvent( event );
76 - }
77 - }
1 + // This Source Code is Copyright & Licenced as indicated below
2 + package org.litesoft.GWT.client.widgets.nonpublic.external;
3 + /*
4 + * Copyright 2006 Mat Gessel <mat.gessel@gmail.com>
5 + *
6 + * Licensed under the Apache License, Version 2.0 (the "License"); you may not
7 + * use this file except in compliance with the License. You may obtain a copy of
8 + * the License at
9 + *
10 + * http://www.apache.org/licenses/LICENSE-2.0
11 + *
12 + * Unless required by applicable law or agreed to in writing, software
13 + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14 + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
15 + * License for the specific language governing permissions and limitations under
16 + * the License.
17 + */
18 +
19 + import com.google.gwt.user.client.*;
20 + import com.google.gwt.user.client.ui.*;
21 +
22 + /**
23 + * A widget wrapper which can process the
24 + * wrapped widget's events.
25 + */
26 + public abstract class EventWrapper extends Composite {
27 + private Widget m_widget;
28 +
29 + /**
30 + * Default constructor for convenience. You will need to call
31 + * {@link #initWidget(Widget)} before calling any {@link Widget} methods.
32 + */
33 + public EventWrapper() {
34 +
35 + }
36 +
37 + public EventWrapper( Widget w, int eventMask ) {
38 + initWidget( w );
39 + sinkEvents( eventMask );
40 + }
41 +
42 + /*
43 + * (non-Javadoc)
44 + * @see com.google.gwt.user.client.ui.Composite#initWidget(com.google.gwt.user.client.ui.Widget)
45 + */
46 + @Override
47 + protected void initWidget( Widget widget ) {
48 + super.initWidget( widget );
49 + m_widget = widget;
50 + }
51 +
52 + @Override
53 + protected Widget getWidget() {
54 + return m_widget;
55 + }
56 +
57 + /*
58 + * (non-Javadoc)
59 + * Hijacks events intended for the wrapped widget's element.
60 + * @see com.google.gwt.user.client.ui.Widget#onAttach()
61 + */
62 + @Override
63 + protected void onAttach() {
64 + super.onAttach();
65 + DOM.setEventListener( getElement(), this );
66 + }
67 +
68 + /**
69 + * Override to process browser events. Don't forget to call super
70 + * implementation if you want the wrapped widget to process events also.
71 + * {@inheritDoc}
72 + */
73 + @Override
74 + public void onBrowserEvent( Event event ) {
75 + m_widget.onBrowserEvent( event );
76 + }
77 + }