// 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/SearchEvent.java
// public class SearchEvent extends GenericEvent {
// 
//     private String searchText;
//     private String account = "All";
//     private int searchType = 0;
//     private String startDate = null;
//     private String endDate = null;
//     private int mediaOnly = 0;
// 
//     public SearchEvent(String text) {
//         this.searchText = text;
//     }
// 
//     public SearchEvent(String text, int type, String account, int mediaOnly, String startDate, String endDate) {
//         this.searchText = text;
//         this.searchType = type;
//         this.account = account;
//         this.mediaOnly = mediaOnly;
//         this.startDate = startDate;
//         this.endDate = endDate;
//     }
// 
//     public int getSearchType(){
//         return this.searchType;
//     }
// 
//     public String getAccount(){
//         return this.account;
//     }
// 
//     public int getMediaOnly() {
//         return this.mediaOnly;
//     }
// 
//     public String getEndDate(){
//         return this.endDate;
//     }
// 
//     public String getStartDate(){
//         return this.startDate;
//     }
// 
//     public String getSearchText() {
//         return this.searchText;}
// }
// 
// 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 gwt.material.design.client.ui.*;
import java.util.Date;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.logical.shared.ValueChangeEvent;
import com.google.gwt.i18n.client.DateTimeFormat;
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.ui.Composite;
import com.google.gwt.user.client.ui.Widget;
import com.google.web.bindery.event.shared.binder.EventBinder;
import gov.wa.wsdot.apps.analytics.client.ClientFactory;
import gov.wa.wsdot.apps.analytics.client.activities.events.SearchEvent;
import gov.wa.wsdot.apps.analytics.util.Consts;
        initWidget(uiBinder.createAndBindUi(this));
        this.clientFactory = clientFactory;
    }

    @UiHandler("searchBtn")
    void onSearch(ClickEvent e){

        if (advSearchTextBox.getText().equalsIgnoreCase("")){
            advSearchTextBox.setText(" ");
        }

        DateTimeFormat fmt = DateTimeFormat.getFormat("/yyyy/M/d");

        String endDate = null;
        String startDate = null;

        if (searchdpStart.getDate() != null) {
            startDate = fmt.format(searchdpStart.getDate());
        }

        if (searchdpEnd.getDate() != null) {
            endDate = fmt.format(searchdpEnd.getDate());
        }

        String account = searchAccountPicker.getSelectedItemText();
        int searchType = Integer.valueOf(searchTypePicker.getSelectedValue());
        String searchTerm = advSearchTextBox.getText();

        int media = (mediaOnly.getValue() ? 1 : 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/SearchEvent.java
// public class SearchEvent extends GenericEvent {
// 
//     private String searchText;
//     private String account = "All";
//     private int searchType = 0;
//     private String startDate = null;
//     private String endDate = null;
//     private int mediaOnly = 0;
// 
//     public SearchEvent(String text) {
//         this.searchText = text;
//     }
// 
//     public SearchEvent(String text, int type, String account, int mediaOnly, String startDate, String endDate) {
//         this.searchText = text;
//         this.searchType = type;
//         this.account = account;
//         this.mediaOnly = mediaOnly;
//         this.startDate = startDate;
//         this.endDate = endDate;
//     }
// 
//     public int getSearchType(){
//         return this.searchType;
//     }
// 
//     public String getAccount(){
//         return this.account;
//     }
// 
//     public int getMediaOnly() {
//         return this.mediaOnly;
//     }
// 
//     public String getEndDate(){
//         return this.endDate;
//     }
// 
//     public String getStartDate(){
//         return this.startDate;
//     }
// 
//     public String getSearchText() {
//         return this.searchText;}
// }
// 
// 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/search/AdvSearchView.java
import gwt.material.design.client.ui.*;
import java.util.Date;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.logical.shared.ValueChangeEvent;
import com.google.gwt.i18n.client.DateTimeFormat;
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.ui.Composite;
import com.google.gwt.user.client.ui.Widget;
import com.google.web.bindery.event.shared.binder.EventBinder;
import gov.wa.wsdot.apps.analytics.client.ClientFactory;
import gov.wa.wsdot.apps.analytics.client.activities.events.SearchEvent;
import gov.wa.wsdot.apps.analytics.util.Consts;

        initWidget(uiBinder.createAndBindUi(this));
        this.clientFactory = clientFactory;
    }

    @UiHandler("searchBtn")
    void onSearch(ClickEvent e){

        if (advSearchTextBox.getText().equalsIgnoreCase("")){
            advSearchTextBox.setText(" ");
        }

        DateTimeFormat fmt = DateTimeFormat.getFormat("/yyyy/M/d");

        String endDate = null;
        String startDate = null;

        if (searchdpStart.getDate() != null) {
            startDate = fmt.format(searchdpStart.getDate());
        }

        if (searchdpEnd.getDate() != null) {
            endDate = fmt.format(searchdpEnd.getDate());
        }

        String account = searchAccountPicker.getSelectedItemText();
        int searchType = Integer.valueOf(searchTypePicker.getSelectedValue());
        String searchTerm = advSearchTextBox.getText();

        int media = (mediaOnly.getValue() ? 1 : 0);

        SearchEvent searchEvent = new SearchEvent(searchTerm, searchType, account, media, startDate, endDate);