// 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/activities/events/SentimentDisplayEvent.java
// public class SentimentDisplayEvent extends GenericEvent {
// 
//     String sentiment;
// 
//     public SentimentDisplayEvent(String sentiment){
//         this.sentiment = sentiment;
//     }
// 
//     public String getSentiment(){
//         return sentiment;
//     }
// }
// 
// 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/SentimentSummary.java
// public class SentimentSummary extends JavaScriptObject {
// 	protected SentimentSummary() {}
// 	
// 	public final native String getId() /*-{ return this._id }-*/;
// 	public final native int getValue() /*-{ return this.value }-*/;
// 	public final native JsArray<SentimentSummary> getSentimentSummary() /*-{ 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.jsonp.client.JsonpRequestBuilder;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
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.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.*;
import com.googlecode.gwt.charts.client.corechart.PieChart;
import com.googlecode.gwt.charts.client.corechart.PieChartOptions;
import com.googlecode.gwt.charts.client.event.SelectEvent;
import com.googlecode.gwt.charts.client.event.SelectHandler;
import com.googlecode.gwt.charts.client.options.ChartArea;
import com.googlecode.gwt.charts.client.options.Legend;
import com.googlecode.gwt.charts.client.options.LegendPosition;
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.activities.events.SentimentDisplayEvent;
import gov.wa.wsdot.apps.analytics.client.resources.Resources;
import gov.wa.wsdot.apps.analytics.shared.SentimentSummary;
import gov.wa.wsdot.apps.analytics.util.Consts;
import gwt.material.design.client.ui.MaterialCardContent;
import gwt.material.design.client.ui.MaterialPreLoader;

        PieChartOptions options = PieChartOptions.create();
        options.setWidth(500);
        options.setHeight(400);
        ChartArea area = ChartArea.create();
        area.setTop(50);
        area.setLeft(25);
        options.setChartArea(area);
        options.setLegend(legend);
        options.setColors("BDBDBD", "26A69A", "FF6E40");

        pieChart.draw(data, options);
    }

    private static Widget getPieChart() {
        if (pieChart == null) {
            pieChart = new PieChart();
            pieChart.addSelectHandler(new SelectHandler() {
                @Override
                public void onSelect(SelectEvent event) {

                    // May be multiple selections.
                    JsArray<Selection> selections = pieChart.getSelection();

                    for (int i = 0; i < selections.length(); i++) {
                        Selection selection = selections.get(i);

                        int row = selection.getRow();
                        // Append the name of the callback function to the JSON URL
                        if (row == 0) {
// 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/activities/events/SentimentDisplayEvent.java
// public class SentimentDisplayEvent extends GenericEvent {
// 
//     String sentiment;
// 
//     public SentimentDisplayEvent(String sentiment){
//         this.sentiment = sentiment;
//     }
// 
//     public String getSentiment(){
//         return sentiment;
//     }
// }
// 
// 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/SentimentSummary.java
// public class SentimentSummary extends JavaScriptObject {
// 	protected SentimentSummary() {}
// 	
// 	public final native String getId() /*-{ return this._id }-*/;
// 	public final native int getValue() /*-{ return this.value }-*/;
// 	public final native JsArray<SentimentSummary> getSentimentSummary() /*-{ 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/sentiment/SentimentPieChart.java
import com.google.gwt.core.client.GWT;
import com.google.gwt.core.client.JsArray;
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.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.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.*;
import com.googlecode.gwt.charts.client.corechart.PieChart;
import com.googlecode.gwt.charts.client.corechart.PieChartOptions;
import com.googlecode.gwt.charts.client.event.SelectEvent;
import com.googlecode.gwt.charts.client.event.SelectHandler;
import com.googlecode.gwt.charts.client.options.ChartArea;
import com.googlecode.gwt.charts.client.options.Legend;
import com.googlecode.gwt.charts.client.options.LegendPosition;
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.activities.events.SentimentDisplayEvent;
import gov.wa.wsdot.apps.analytics.client.resources.Resources;
import gov.wa.wsdot.apps.analytics.shared.SentimentSummary;
import gov.wa.wsdot.apps.analytics.util.Consts;
import gwt.material.design.client.ui.MaterialCardContent;
import gwt.material.design.client.ui.MaterialPreLoader;


        PieChartOptions options = PieChartOptions.create();
        options.setWidth(500);
        options.setHeight(400);
        ChartArea area = ChartArea.create();
        area.setTop(50);
        area.setLeft(25);
        options.setChartArea(area);
        options.setLegend(legend);
        options.setColors("BDBDBD", "26A69A", "FF6E40");

        pieChart.draw(data, options);
    }

    private static Widget getPieChart() {
        if (pieChart == null) {
            pieChart = new PieChart();
            pieChart.addSelectHandler(new SelectHandler() {
                @Override
                public void onSelect(SelectEvent event) {

                    // May be multiple selections.
                    JsArray<Selection> selections = pieChart.getSelection();

                    for (int i = 0; i < selections.length(); i++) {
                        Selection selection = selections.get(i);

                        int row = selection.getRow();
                        // Append the name of the callback function to the JSON URL
                        if (row == 0) {
                            clientFactory.getEventBus().fireEvent(new SentimentDisplayEvent("neutral"));