|
@@ -1,59 +1,59 @@ |
1 |
|
- |
package org.litesoft.GWT.client.pavsupport; |
2 |
|
- |
|
3 |
|
- |
import org.litesoft.commonfoundation.typeutils.*; |
4 |
|
- |
|
5 |
|
- |
import com.google.gwt.place.shared.*; |
6 |
|
- |
import com.google.gwt.user.client.ui.*; |
7 |
|
- |
|
8 |
|
- |
/** |
9 |
|
- |
* Simple Activity implementation that is always willing to stop, and does |
10 |
|
- |
* nothing onStop and onCancel. |
11 |
|
- |
*/ |
12 |
|
- |
public abstract class AbstractActivity<View extends AbstractView> implements Activity, |
13 |
|
- |
AbstractPresenter { |
14 |
|
- |
protected final View mView; |
15 |
|
- |
protected final PlaceChanger mPlaceChanger; |
16 |
|
- |
|
17 |
|
- |
public AbstractActivity( View pView, PlaceChanger pPlaceChanger ) { |
18 |
|
- |
mView = Objects.assertNotNull( "View", pView ); |
19 |
|
- |
mPlaceChanger = Objects.assertNotNull( "PlaceChanger", pPlaceChanger ); |
20 |
|
- |
} |
21 |
|
- |
|
22 |
|
- |
@SuppressWarnings("unchecked") |
23 |
|
- |
@Override |
24 |
|
- |
public final void start( AcceptsOneWidget pPanel ) { |
25 |
|
- |
start(); |
26 |
|
- |
mView.setPresenter( this ); |
27 |
|
- |
pPanel.setWidget( mView ); |
28 |
|
- |
} |
29 |
|
- |
|
30 |
|
- |
@Override |
31 |
|
- |
public Place getWhere() { |
32 |
|
- |
return mPlaceChanger.getWhere(); |
33 |
|
- |
} |
34 |
|
- |
|
35 |
|
- |
@Override |
36 |
|
- |
public void goBack() { |
37 |
|
- |
mPlaceChanger.goBack(); |
38 |
|
- |
} |
39 |
|
- |
|
40 |
|
- |
@Override |
41 |
|
- |
public PlaceChanger.GoToPlace goForwardTo( Place pNewPlace ) { |
42 |
|
- |
return mPlaceChanger.goForwardTo( pNewPlace ); |
43 |
|
- |
} |
44 |
|
- |
|
45 |
|
- |
abstract protected void start(); |
46 |
|
- |
|
47 |
|
- |
@Override |
48 |
|
- |
public String mayStop() { |
49 |
|
- |
return null; |
50 |
|
- |
} |
51 |
|
- |
|
52 |
|
- |
@Override |
53 |
|
- |
public void onCancel() { |
54 |
|
- |
} |
55 |
|
- |
|
56 |
|
- |
@Override |
57 |
|
- |
public void onStop() { |
58 |
|
- |
} |
59 |
|
- |
} |
|
1 |
+ |
package org.litesoft.GWT.client.pavsupport; |
|
2 |
+ |
|
|
3 |
+ |
import org.litesoft.commonfoundation.base.*; |
|
4 |
+ |
|
|
5 |
+ |
import com.google.gwt.place.shared.*; |
|
6 |
+ |
import com.google.gwt.user.client.ui.*; |
|
7 |
+ |
|
|
8 |
+ |
/** |
|
9 |
+ |
* Simple Activity implementation that is always willing to stop, and does |
|
10 |
+ |
* nothing onStop and onCancel. |
|
11 |
+ |
*/ |
|
12 |
+ |
public abstract class AbstractActivity<View extends AbstractView> implements Activity, |
|
13 |
+ |
AbstractPresenter { |
|
14 |
+ |
protected final View mView; |
|
15 |
+ |
protected final PlaceChanger mPlaceChanger; |
|
16 |
+ |
|
|
17 |
+ |
public AbstractActivity( View pView, PlaceChanger pPlaceChanger ) { |
|
18 |
+ |
mView = Confirm.isNotNull( "View", pView ); |
|
19 |
+ |
mPlaceChanger = Confirm.isNotNull( "PlaceChanger", pPlaceChanger ); |
|
20 |
+ |
} |
|
21 |
+ |
|
|
22 |
+ |
@SuppressWarnings("unchecked") |
|
23 |
+ |
@Override |
|
24 |
+ |
public final void start( AcceptsOneWidget pPanel ) { |
|
25 |
+ |
start(); |
|
26 |
+ |
mView.setPresenter( this ); |
|
27 |
+ |
pPanel.setWidget( mView ); |
|
28 |
+ |
} |
|
29 |
+ |
|
|
30 |
+ |
@Override |
|
31 |
+ |
public Place getWhere() { |
|
32 |
+ |
return mPlaceChanger.getWhere(); |
|
33 |
+ |
} |
|
34 |
+ |
|
|
35 |
+ |
@Override |
|
36 |
+ |
public void goBack() { |
|
37 |
+ |
mPlaceChanger.goBack(); |
|
38 |
+ |
} |
|
39 |
+ |
|
|
40 |
+ |
@Override |
|
41 |
+ |
public PlaceChanger.GoToPlace goForwardTo( Place pNewPlace ) { |
|
42 |
+ |
return mPlaceChanger.goForwardTo( pNewPlace ); |
|
43 |
+ |
} |
|
44 |
+ |
|
|
45 |
+ |
abstract protected void start(); |
|
46 |
+ |
|
|
47 |
+ |
@Override |
|
48 |
+ |
public String mayStop() { |
|
49 |
+ |
return null; |
|
50 |
+ |
} |
|
51 |
+ |
|
|
52 |
+ |
@Override |
|
53 |
+ |
public void onCancel() { |
|
54 |
+ |
} |
|
55 |
+ |
|
|
56 |
+ |
@Override |
|
57 |
+ |
public void onStop() { |
|
58 |
+ |
} |
|
59 |
+ |
} |