/*
* Spadger - an open source discussion forum system.
*
* Copyright (C) 2010 The Spadger Team
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
*
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.ajiaojr.spadger.client;
import net.ajiaojr.spadger.client.activity.ContentAreaActivityMapper;
import net.ajiaojr.spadger.client.desktop.DesktopClientFactory;
import net.ajiaojr.spadger.client.place.DashboardPlace;
import net.ajiaojr.spadger.client.place.SpadgerPlaceHistoryMapper;
import net.ajiaojr.spadger.client.view.MainUiView;
import com.google.gwt.activity.shared.ActivityManager;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.shared.EventBus;
import com.google.gwt.place.shared.PlaceHistoryHandler;
import com.google.gwt.place.shared.PlaceHistoryMapper;
import com.google.gwt.user.client.ui.RootLayoutPanel;
/**
* Main program entry class.
*
* @author The Spadger Team
*/
public class Spadger implements EntryPoint {
protected ClientFactory clientFactory;
protected ClientFactory createClientFactory() {
return GWT.create(DesktopClientFactory.class);
}
/*
* (non-Javadoc)
*
* @see com.google.gwt.core.client.EntryPoint#onModuleLoad()
*/
@Override
public void onModuleLoad() {
this.clientFactory = createClientFactory();
MainUiView mainUiView = clientFactory.getMainUiView();
EventBus eventBus = clientFactory.getEventBus();
ActivityManager manager = new ActivityManager(new ContentAreaActivityMapper(
clientFactory), eventBus);
manager.setDisplay(mainUiView.getContentArea());
PlaceHistoryMapper historyMapper = GWT
.create(SpadgerPlaceHistoryMapper.class);
PlaceHistoryHandler handler = new PlaceHistoryHandler(historyMapper);
handler.register(clientFactory.getPlaceController(), eventBus,
new DashboardPlace());
RootLayoutPanel.get().add(mainUiView);
handler.handleCurrentHistory();
}
}