// Path: src/main/java/gov/wa/wsdot/apps/analytics/client/ClientFactory.java
// public interface ClientFactory {
//     EventBus getEventBus();
//     PlaceController getPlaceController();
//     AnalyticsView getAnalyticsView();
// }
// 
// Path: src/main/java/gov/wa/wsdot/apps/analytics/client/activities/events/DateSubmitEvent.java
// public class DateSubmitEvent extends GenericEvent {
// 
// 
//     private final String dateRange;
//     private final String account;
//     private final Date startDate;
//     private final Date endDate;
// 
//     public DateSubmitEvent(String dateRange, Date startDate, Date endDate, String account) {
//         this.dateRange = dateRange;
//         this.account = account;
//         this.startDate = startDate;
//         this.endDate = endDate;
//     }
// 
//     public String getDateRange() {
//         return this.dateRange;
//     }
// 
//     public String getAccount() {
//         return this.account;
//     }
// 
//     public Date getStartDate(){ return this.startDate;}
// 
//     public Date getEndDate(){ return this.endDate;}
// }
// 
// Path: src/main/java/gov/wa/wsdot/apps/analytics/client/resources/Resources.java
// public interface Resources extends ClientBundle {
// 	public static final Resources INSTANCE = GWT.create(Resources.class);
// 	
//     @Source("GlobalStyles.css")
//     public Styles css();
// 
//     @Source("WSDOTacronymWhite.png")
//     ImageResource tacronymWhiteLogoPNG();
// 
//     public interface Styles extends CssResource {
//         // CSS classes
// 
//         String loader();
// 
//         String logo();
// 
//         // Graph
//         String graphBlock();
//         String overflowHidden();
//     }
// }
// 
// Path: src/main/java/gov/wa/wsdot/apps/analytics/shared/FollowerSummary.java
// public class FollowerSummary extends JavaScriptObject {
// 	protected FollowerSummary() {}
// 	
// 	public final native double getId() /*-{ return this._id }-*/;
// 	public final native int getValue() /*-{ return this.value }-*/;
// 	public final native JsArray<FollowerSummary> getFollowerSummary() /*-{ return this }-*/;
// }
// 
// Path: src/main/java/gov/wa/wsdot/apps/analytics/shared/TweetSummary.java
// public class TweetSummary extends JavaScriptObject {
// 	protected TweetSummary() {}
// 	
// 	public final native double getId() /*-{ return this._id }-*/;
// 	public final native TweetValue getValue() /*-{ return this.value }-*/;
// 	public final native JsArray<TweetSummary> getTweetSummary() /*-{ return this }-*/;
// }
// 
// Path: src/main/java/gov/wa/wsdot/apps/analytics/util/Consts.java
// public final class Consts {
// 
//     public static final String HOST_URL = "http://127.0.0.1:3001";
// 
//     public static final String DEFAULT_ACCOUNT = "wsdot";
// 
//     /**
//      * The caller references the constants using <tt>Consts.EMPTY_STRING</tt>,
//      * and so on. Thus, the caller should be prevented from constructing objects of
//      * this class, by declaring this private constructor.
//      */
//     private Consts() {
//         //this prevents even the native class from
//         //calling this ctor as well :
//         throw new AssertionError();
//     }
// 
// }


import com.google.gwt.core.client.GWT;
import com.google.gwt.core.client.JsArray;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.i18n.client.DateTimeFormat;
import com.google.gwt.jsonp.client.JsonpRequestBuilder;
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.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.Widget;
import com.google.web.bindery.event.shared.binder.EventBinder;
import com.google.web.bindery.event.shared.binder.EventHandler;
import com.googlecode.gwt.charts.client.ChartLoader;
import com.googlecode.gwt.charts.client.ChartPackage;
import com.googlecode.gwt.charts.client.ColumnType;
import com.googlecode.gwt.charts.client.DataTable;
import com.googlecode.gwt.charts.client.corechart.AreaChart;
import com.googlecode.gwt.charts.client.corechart.AreaChartOptions;
import com.googlecode.gwt.charts.client.options.*;
import gov.wa.wsdot.apps.analytics.client.ClientFactory;
import gov.wa.wsdot.apps.analytics.client.activities.events.DateSubmitEvent;
import gov.wa.wsdot.apps.analytics.client.resources.Resources;
import gov.wa.wsdot.apps.analytics.shared.FollowerSummary;
import gov.wa.wsdot.apps.analytics.shared.TweetSummary;
import gov.wa.wsdot.apps.analytics.util.Consts;
import gwt.material.design.client.constants.IconType;
import gwt.material.design.client.ui.*;
import java.util.ArrayList;
import java.util.Date;

    final Resources res;

    private static AreaChart tweetsChart;
    private static AreaChart followersChart;

    private static String dateRange = "";
    private static String account = Consts.DEFAULT_ACCOUNT;

    private static final String JSON_URL = Consts.HOST_URL + "/summary";
    static JsArray<TweetSummary> tweetSummary;
    static JsArray<FollowerSummary> followerSummary;
    static ArrayList<String> dateArrayList = new ArrayList<String>();

    private static String defaultDateRange = "";

    private static ClientFactory clientFactory;

    public SummaryChart(ClientFactory clientFactory){

        this.clientFactory = clientFactory;

        res = GWT.create(Resources.class);
        res.css().ensureInjected();
        eventBinder.bindEventHandlers(this, clientFactory.getEventBus());
        initWidget(uiBinder.createAndBindUi(this));

    }

    @EventHandler
// Path: src/main/java/gov/wa/wsdot/apps/analytics/client/ClientFactory.java
// public interface ClientFactory {
//     EventBus getEventBus();
//     PlaceController getPlaceController();
//     AnalyticsView getAnalyticsView();
// }
// 
// Path: src/main/java/gov/wa/wsdot/apps/analytics/client/activities/events/DateSubmitEvent.java
// public class DateSubmitEvent extends GenericEvent {
// 
// 
//     private final String dateRange;
//     private final String account;
//     private final Date startDate;
//     private final Date endDate;
// 
//     public DateSubmitEvent(String dateRange, Date startDate, Date endDate, String account) {
//         this.dateRange = dateRange;
//         this.account = account;
//         this.startDate = startDate;
//         this.endDate = endDate;
//     }
// 
//     public String getDateRange() {
//         return this.dateRange;
//     }
// 
//     public String getAccount() {
//         return this.account;
//     }
// 
//     public Date getStartDate(){ return this.startDate;}
// 
//     public Date getEndDate(){ return this.endDate;}
// }
// 
// Path: src/main/java/gov/wa/wsdot/apps/analytics/client/resources/Resources.java
// public interface Resources extends ClientBundle {
// 	public static final Resources INSTANCE = GWT.create(Resources.class);
// 	
//     @Source("GlobalStyles.css")
//     public Styles css();
// 
//     @Source("WSDOTacronymWhite.png")
//     ImageResource tacronymWhiteLogoPNG();
// 
//     public interface Styles extends CssResource {
//         // CSS classes
// 
//         String loader();
// 
//         String logo();
// 
//         // Graph
//         String graphBlock();
//         String overflowHidden();
//     }
// }
// 
// Path: src/main/java/gov/wa/wsdot/apps/analytics/shared/FollowerSummary.java
// public class FollowerSummary extends JavaScriptObject {
// 	protected FollowerSummary() {}
// 	
// 	public final native double getId() /*-{ return this._id }-*/;
// 	public final native int getValue() /*-{ return this.value }-*/;
// 	public final native JsArray<FollowerSummary> getFollowerSummary() /*-{ return this }-*/;
// }
// 
// Path: src/main/java/gov/wa/wsdot/apps/analytics/shared/TweetSummary.java
// public class TweetSummary extends JavaScriptObject {
// 	protected TweetSummary() {}
// 	
// 	public final native double getId() /*-{ return this._id }-*/;
// 	public final native TweetValue getValue() /*-{ return this.value }-*/;
// 	public final native JsArray<TweetSummary> getTweetSummary() /*-{ return this }-*/;
// }
// 
// Path: src/main/java/gov/wa/wsdot/apps/analytics/util/Consts.java
// public final class Consts {
// 
//     public static final String HOST_URL = "http://127.0.0.1:3001";
// 
//     public static final String DEFAULT_ACCOUNT = "wsdot";
// 
//     /**
//      * The caller references the constants using <tt>Consts.EMPTY_STRING</tt>,
//      * and so on. Thus, the caller should be prevented from constructing objects of
//      * this class, by declaring this private constructor.
//      */
//     private Consts() {
//         //this prevents even the native class from
//         //calling this ctor as well :
//         throw new AssertionError();
//     }
// 
// }


// Path: src/main/java/gov/wa/wsdot/apps/analytics/client/activities/twitter/view/summary/SummaryChart.java
import com.google.gwt.core.client.GWT;
import com.google.gwt.core.client.JsArray;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.i18n.client.DateTimeFormat;
import com.google.gwt.jsonp.client.JsonpRequestBuilder;
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.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.Widget;
import com.google.web.bindery.event.shared.binder.EventBinder;
import com.google.web.bindery.event.shared.binder.EventHandler;
import com.googlecode.gwt.charts.client.ChartLoader;
import com.googlecode.gwt.charts.client.ChartPackage;
import com.googlecode.gwt.charts.client.ColumnType;
import com.googlecode.gwt.charts.client.DataTable;
import com.googlecode.gwt.charts.client.corechart.AreaChart;
import com.googlecode.gwt.charts.client.corechart.AreaChartOptions;
import com.googlecode.gwt.charts.client.options.*;
import gov.wa.wsdot.apps.analytics.client.ClientFactory;
import gov.wa.wsdot.apps.analytics.client.activities.events.DateSubmitEvent;
import gov.wa.wsdot.apps.analytics.client.resources.Resources;
import gov.wa.wsdot.apps.analytics.shared.FollowerSummary;
import gov.wa.wsdot.apps.analytics.shared.TweetSummary;
import gov.wa.wsdot.apps.analytics.util.Consts;
import gwt.material.design.client.constants.IconType;
import gwt.material.design.client.ui.*;
import java.util.ArrayList;
import java.util.Date;


    final Resources res;

    private static AreaChart tweetsChart;
    private static AreaChart followersChart;

    private static String dateRange = "";
    private static String account = Consts.DEFAULT_ACCOUNT;

    private static final String JSON_URL = Consts.HOST_URL + "/summary";
    static JsArray<TweetSummary> tweetSummary;
    static JsArray<FollowerSummary> followerSummary;
    static ArrayList<String> dateArrayList = new ArrayList<String>();

    private static String defaultDateRange = "";

    private static ClientFactory clientFactory;

    public SummaryChart(ClientFactory clientFactory){

        this.clientFactory = clientFactory;

        res = GWT.create(Resources.class);
        res.css().ensureInjected();
        eventBinder.bindEventHandlers(this, clientFactory.getEventBus());
        initWidget(uiBinder.createAndBindUi(this));

    }

    @EventHandler
    void onDateSubmit(DateSubmitEvent event){