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