Search in sources :

Example 1 with AnnotatedTimeLine

use of com.google.gwt.visualization.client.visualizations.AnnotatedTimeLine in project opennms by OpenNMS.

the class Application method onModuleLoad.

/**
   * This is the entry point method.
   */
public void onModuleLoad() {
    m_chartService = new DefaultChartService();
    Image img = new Image();
    img.setUrl("../images/logo.png");
    img.getElement().getStyle().setPaddingTop(14, Unit.PX);
    img.getElement().getStyle().setPaddingLeft(14, Unit.PX);
    FlowPanel header = new FlowPanel();
    header.getElement().setId("header");
    header.add(img);
    final DockLayoutPanel dockLayoutPanel = new DockLayoutPanel(Unit.PX);
    dockLayoutPanel.addNorth(header, 75.00);
    RootLayoutPanel.get().add(dockLayoutPanel);
    m_nav = new Navigation();
    m_nav.addLocationUpdateEventHandler(this);
    m_nav.addHostUpdateEventHandler(this);
    m_flowPanel = new FlowPanel();
    Runnable timelineCallback = new Runnable() {

        public void run() {
            m_chartService.getAllLocationsAvailability(new RequestCallback() {

                @Override
                public void onResponseReceived(Request request, Response response) {
                    if (response.getStatusCode() == 200) {
                        m_timeline = new AnnotatedTimeLine(ChartUtils.convertJSONToDataTable(response.getText()), createTimelineOptions(), "440px", "250px");
                        m_flowPanel.add(m_timeline);
                        m_flowPanel.add(m_nav);
                        dockLayoutPanel.add(m_flowPanel);
                    }
                }

                @Override
                public void onError(Request request, Throwable exception) {
                    Window.alert("Error Initializing Chart");
                }
            });
        }
    };
    VisualizationUtils.loadVisualizationApi(timelineCallback, AnnotatedTimeLine.PACKAGE);
    initializeNav();
}
Also used : Response(com.google.gwt.http.client.Response) AnnotatedTimeLine(com.google.gwt.visualization.client.visualizations.AnnotatedTimeLine) RequestCallback(com.google.gwt.http.client.RequestCallback) DockLayoutPanel(com.google.gwt.user.client.ui.DockLayoutPanel) FlowPanel(com.google.gwt.user.client.ui.FlowPanel) Request(com.google.gwt.http.client.Request) Image(com.google.gwt.user.client.ui.Image)

Aggregations

Request (com.google.gwt.http.client.Request)1 RequestCallback (com.google.gwt.http.client.RequestCallback)1 Response (com.google.gwt.http.client.Response)1 DockLayoutPanel (com.google.gwt.user.client.ui.DockLayoutPanel)1 FlowPanel (com.google.gwt.user.client.ui.FlowPanel)1 Image (com.google.gwt.user.client.ui.Image)1 AnnotatedTimeLine (com.google.gwt.visualization.client.visualizations.AnnotatedTimeLine)1