Enable the "Details" buttons.
[online-glom:gwt-glom.git] / src / main / java / org / glom / web / client / activity / DetailsActivity.java
1 /*
2  * Copyright (C) 2011 Openismus GmbH
3  *
4  * This file is part of GWT-Glom.
5  *
6  * GWT-Glom is free software: you can redistribute it and/or modify it
7  * under the terms of the GNU Lesser General Public License as published by the
8  * Free Software Foundation, either version 3 of the License, or (at your
9  * option) any later version.
10  *
11  * GWT-Glom is distributed in the hope that it will be useful, but WITHOUT
12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
14  * for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with GWT-Glom.  If not, see <http://www.gnu.org/licenses/>.
18  */
19
20 package org.glom.web.client.activity;
21
22 import org.glom.web.client.ClientFactory;
23 import org.glom.web.client.place.DetailsPlace;
24 import org.glom.web.client.ui.DetailsView;
25
26 import com.google.gwt.activity.shared.AbstractActivity;
27 import com.google.gwt.event.shared.EventBus;
28 import com.google.gwt.place.shared.Place;
29 import com.google.gwt.user.client.ui.AcceptsOneWidget;
30
31 /**
32  * @author Ben Konrath <ben@bagu.org>
33  * 
34  */
35 public class DetailsActivity extends AbstractActivity implements DetailsView.Presenter {
36         private final String documentTitle;
37         private final ClientFactory clientFactory;
38         private final DetailsView detailsView;
39
40         /**
41          * 
42          */
43         public DetailsActivity(DetailsPlace place, ClientFactory clientFactory) {
44                 this.documentTitle = place.getDocumentTitle();
45                 this.clientFactory = clientFactory;
46                 detailsView = clientFactory.getDetailsView();
47         }
48
49         /*
50          * (non-Javadoc)
51          * 
52          * @see com.google.gwt.activity.shared.Activity#start(com.google.gwt.user.client.ui.AcceptsOneWidget,
53          * com.google.gwt.event.shared.EventBus)
54          */
55         @Override
56         public void start(AcceptsOneWidget panel, EventBus eventBus) {
57                 // register this class as the presenter
58                 detailsView.setPresenter(this);
59
60                 // TODO RPC and / or EventBus code goes here
61
62                 // indicate that the view is ready to be displayed
63                 panel.setWidget(detailsView.asWidget());
64         }
65
66         /*
67          * (non-Javadoc)
68          * 
69          * @see com.google.gwt.activity.shared.Activity#onCancel()
70          */
71         @Override
72         public void onCancel() {
73                 // TODO detailsView.clear();
74         }
75
76         /*
77          * (non-Javadoc)
78          * 
79          * @see com.google.gwt.activity.shared.Activity#onStop()
80          */
81         @Override
82         public void onStop() {
83                 // TODO detailsView.clear();
84         }
85
86         /*
87          * (non-Javadoc)
88          * 
89          * @see org.glom.web.client.ui.DetailsView.Presenter#goTo(com.google.gwt.place.shared.Place)
90          */
91         @Override
92         public void goTo(Place place) {
93                 clientFactory.getPlaceController().goTo(place);
94         }
95
96 }