// Path: gwt/src/opus/gwt/management/console/client/JSVariableHandler.java
// public class JSVariableHandler {
// 
// 	public JSVariableHandler(){}
// 	
// 	public native String getRepoBaseURL()/*-{
// 		return $wnd.repoBaseURL;
// 	}-*/;
// 
// 	public native String getDeployerBaseURL()/*-{
// 		return $wnd.deployerBaseURL;
// 	}-*/;
// 	
// 	public native String getCommunityBaseURL()/*-{
// 		return $wnd.communityBaseURL;
// 	}-*/;
// 	
// 	public native String getProjectToken()/*-{
// 		return $wnd.projectToken;
// 	}-*/;
// 	
// 	public native String getBuildProjectURL()/*-{
// 		return $wnd.buildProjectURL;
// 	}-*/;
// 	
// 	public native String getCSRFTokenURL()/*-{
// 		return $wnd.csrftoken;
// 	}-*/;
// 	
// 	public native String getUser()/*-{
// 		return $wnd.user;
// 	}-*/;
// 
// 
// }
// 
// Path: gwt/src/opus/gwt/management/console/client/event/PanelTransitionEvent.java
// public class PanelTransitionEvent extends GwtEvent<PanelTransitionEventHandler> {
// 	
// 	public static Type<PanelTransitionEventHandler> TYPE = new Type<PanelTransitionEventHandler>();
// 	//private String transitionType;
// 	private Widget panel;
// 	public enum TransitionTypes{PREVIOUS, NEXT, DELETE, SETTINGS, DEPLOY, PROJECTS, DASHBOARD};
// 	private TransitionTypes transitionType;
// 	public String name;
// 	
// 	public PanelTransitionEvent(TransitionTypes transitionType, Widget panel){
// 		this.transitionType = transitionType;
// 		this.panel = panel;
// 	}
// 
// 	public PanelTransitionEvent(TransitionTypes transitionType){
// 		this.transitionType = transitionType;
// 	}
// 
// 	public PanelTransitionEvent(TransitionTypes transitionType, String name){
// 		this.name = name;
// 		this.transitionType = transitionType;
// 	}
// 	
// 	public TransitionTypes getTransitionType(){
// 		return transitionType;
// 	}
// 	
// 	public Widget getPanel(){
// 		return panel;
// 	}
// 	
// 	public String getName(){
// 		return name;
// 	}
// 	
//   	@Override
//   	public Type<PanelTransitionEventHandler> getAssociatedType() {
// 	  return TYPE;
//   	}
// 
//   	@Override
//   	protected void dispatch(PanelTransitionEventHandler handler) {
// 	  handler.onPanelTransition(this);
//   	}
// }


import java.util.HashMap;
import opus.gwt.management.console.client.ClientFactory;
import opus.gwt.management.console.client.JSVariableHandler;
import opus.gwt.management.console.client.event.DeleteProjectEvent;
import opus.gwt.management.console.client.event.PanelTransitionEvent;
import opus.gwt.management.console.client.event.PanelTransitionEventHandler;
import opus.gwt.management.console.client.overlays.Application;
import opus.gwt.management.console.client.overlays.Project;
import opus.gwt.management.console.client.resources.ManagementConsoleControllerResources.ManagementConsoleControllerStyle;
import com.google.gwt.core.client.GWT;
import com.google.gwt.core.client.JsArrayString;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.dom.client.MouseOutEvent;
import com.google.gwt.event.dom.client.MouseOutHandler;
import com.google.gwt.event.dom.client.MouseOverEvent;
import com.google.gwt.event.dom.client.MouseOverHandler;
import com.google.gwt.event.shared.EventBus;
import com.google.gwt.http.client.Request;
import com.google.gwt.http.client.RequestBuilder;
import com.google.gwt.http.client.RequestCallback;
import com.google.gwt.http.client.RequestException;
import com.google.gwt.http.client.Response;
import com.google.gwt.http.client.URL;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.uibinder.client.UiHandler;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.FlexTable;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.FocusPanel;
import com.google.gwt.user.client.ui.FormPanel;
import com.google.gwt.user.client.ui.Hidden;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.PopupPanel;
import com.google.gwt.user.client.ui.Widget;
import com.google.gwt.user.client.ui.FormPanel.SubmitCompleteEvent;
import com.google.gwt.user.client.ui.FormPanel.SubmitEvent;
	@UiField Button noThanksButton;
	@UiField FlowPanel deleteTitlePanel;
	
	public DashboardPanel(ClientFactory clientFactory) {
		initWidget(uiBinder.createAndBindUi(this));
		this.eventBus = clientFactory.getEventBus();
		this.clientFactory = clientFactory;
		this.JSVarHandler = clientFactory.getJSVariableHandler();
		this.applications = clientFactory.getApplications();
		activeButton.setText("");
		deleteForm = new FormPanel();
		registerHandlers();
		setDeletePopupPanelInitialState();
	}
	
	private void registerHandlers() {
		eventBus.addHandler(PanelTransitionEvent.TYPE, 
				new PanelTransitionEventHandler(){
					public void onPanelTransition(PanelTransitionEvent event){
						if(event.getTransitionType() == PanelTransitionEvent.TransitionTypes.DASHBOARD){
							projectName = event.name;
							projectLabel.setText(projectName);
							handleProjectInformation(projectName);
						}
					}
			});
	}
	
	@UiHandler("settingsButton")
	void onSettingsButtonClick(ClickEvent event){
// Path: gwt/src/opus/gwt/management/console/client/JSVariableHandler.java
// public class JSVariableHandler {
// 
// 	public JSVariableHandler(){}
// 	
// 	public native String getRepoBaseURL()/*-{
// 		return $wnd.repoBaseURL;
// 	}-*/;
// 
// 	public native String getDeployerBaseURL()/*-{
// 		return $wnd.deployerBaseURL;
// 	}-*/;
// 	
// 	public native String getCommunityBaseURL()/*-{
// 		return $wnd.communityBaseURL;
// 	}-*/;
// 	
// 	public native String getProjectToken()/*-{
// 		return $wnd.projectToken;
// 	}-*/;
// 	
// 	public native String getBuildProjectURL()/*-{
// 		return $wnd.buildProjectURL;
// 	}-*/;
// 	
// 	public native String getCSRFTokenURL()/*-{
// 		return $wnd.csrftoken;
// 	}-*/;
// 	
// 	public native String getUser()/*-{
// 		return $wnd.user;
// 	}-*/;
// 
// 
// }
// 
// Path: gwt/src/opus/gwt/management/console/client/event/PanelTransitionEvent.java
// public class PanelTransitionEvent extends GwtEvent<PanelTransitionEventHandler> {
// 	
// 	public static Type<PanelTransitionEventHandler> TYPE = new Type<PanelTransitionEventHandler>();
// 	//private String transitionType;
// 	private Widget panel;
// 	public enum TransitionTypes{PREVIOUS, NEXT, DELETE, SETTINGS, DEPLOY, PROJECTS, DASHBOARD};
// 	private TransitionTypes transitionType;
// 	public String name;
// 	
// 	public PanelTransitionEvent(TransitionTypes transitionType, Widget panel){
// 		this.transitionType = transitionType;
// 		this.panel = panel;
// 	}
// 
// 	public PanelTransitionEvent(TransitionTypes transitionType){
// 		this.transitionType = transitionType;
// 	}
// 
// 	public PanelTransitionEvent(TransitionTypes transitionType, String name){
// 		this.name = name;
// 		this.transitionType = transitionType;
// 	}
// 	
// 	public TransitionTypes getTransitionType(){
// 		return transitionType;
// 	}
// 	
// 	public Widget getPanel(){
// 		return panel;
// 	}
// 	
// 	public String getName(){
// 		return name;
// 	}
// 	
//   	@Override
//   	public Type<PanelTransitionEventHandler> getAssociatedType() {
// 	  return TYPE;
//   	}
// 
//   	@Override
//   	protected void dispatch(PanelTransitionEventHandler handler) {
// 	  handler.onPanelTransition(this);
//   	}
// }


// Path: gwt/src/opus/gwt/management/console/client/dashboard/DashboardPanel.java
import java.util.HashMap;
import opus.gwt.management.console.client.ClientFactory;
import opus.gwt.management.console.client.JSVariableHandler;
import opus.gwt.management.console.client.event.DeleteProjectEvent;
import opus.gwt.management.console.client.event.PanelTransitionEvent;
import opus.gwt.management.console.client.event.PanelTransitionEventHandler;
import opus.gwt.management.console.client.overlays.Application;
import opus.gwt.management.console.client.overlays.Project;
import opus.gwt.management.console.client.resources.ManagementConsoleControllerResources.ManagementConsoleControllerStyle;
import com.google.gwt.core.client.GWT;
import com.google.gwt.core.client.JsArrayString;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.dom.client.MouseOutEvent;
import com.google.gwt.event.dom.client.MouseOutHandler;
import com.google.gwt.event.dom.client.MouseOverEvent;
import com.google.gwt.event.dom.client.MouseOverHandler;
import com.google.gwt.event.shared.EventBus;
import com.google.gwt.http.client.Request;
import com.google.gwt.http.client.RequestBuilder;
import com.google.gwt.http.client.RequestCallback;
import com.google.gwt.http.client.RequestException;
import com.google.gwt.http.client.Response;
import com.google.gwt.http.client.URL;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.uibinder.client.UiHandler;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.FlexTable;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.FocusPanel;
import com.google.gwt.user.client.ui.FormPanel;
import com.google.gwt.user.client.ui.Hidden;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.PopupPanel;
import com.google.gwt.user.client.ui.Widget;
import com.google.gwt.user.client.ui.FormPanel.SubmitCompleteEvent;
import com.google.gwt.user.client.ui.FormPanel.SubmitEvent;

	@UiField Button noThanksButton;
	@UiField FlowPanel deleteTitlePanel;
	
	public DashboardPanel(ClientFactory clientFactory) {
		initWidget(uiBinder.createAndBindUi(this));
		this.eventBus = clientFactory.getEventBus();
		this.clientFactory = clientFactory;
		this.JSVarHandler = clientFactory.getJSVariableHandler();
		this.applications = clientFactory.getApplications();
		activeButton.setText("");
		deleteForm = new FormPanel();
		registerHandlers();
		setDeletePopupPanelInitialState();
	}
	
	private void registerHandlers() {
		eventBus.addHandler(PanelTransitionEvent.TYPE, 
				new PanelTransitionEventHandler(){
					public void onPanelTransition(PanelTransitionEvent event){
						if(event.getTransitionType() == PanelTransitionEvent.TransitionTypes.DASHBOARD){
							projectName = event.name;
							projectLabel.setText(projectName);
							handleProjectInformation(projectName);
						}
					}
			});
	}
	
	@UiHandler("settingsButton")
	void onSettingsButtonClick(ClickEvent event){
		eventBus.fireEvent(new PanelTransitionEvent(PanelTransitionEvent.TransitionTypes.SETTINGS, "worklog"));