org.opennms.features.poller.remote.gwt.client
Class DefaultLocationManager

java.lang.Object
  extended by org.opennms.features.poller.remote.gwt.client.DefaultLocationManager
All Implemented Interfaces:
com.google.gwt.event.shared.EventHandler, ApplicationDeselectedEventHandler, ApplicationSelectedEventHandler, GWTMarkerClickedEventHandler, GWTMarkerInfoWindowRefreshHandler, LocationPanelSelectEventHandler, MapPanelBoundsChangedEventHandler, FilterPanel.FiltersChangedEventHandler, FilterPanel.StatusSelectionChangedEventHandler, LocationManager, MapRemoteEventHandler, RemotePollerPresenter, TagPanel.TagClearedEventHandler, TagPanel.TagSelectedEventHandler

public class DefaultLocationManager
extends Object
implements LocationManager, RemotePollerPresenter

This class implements both LocationManager (the model portion of the webapp) and RemotePollerPresenter (the controller portion of the webapp code). It is responsible for maintaining the knowledgebase of Location objects and responding to events triggered when:

If this class ever grows too large, we can split it into separate model and controller classes.

Since:
1.8.1
Version:
$Id: $
Author:
ranger

Nested Class Summary
 class DefaultLocationManager.ApplicationUpdater
           
 class DefaultLocationManager.LocationUpdater
           
 
Field Summary
 
Fields inherited from interface org.opennms.features.poller.remote.gwt.client.remoteevents.MapRemoteEventHandler
LOCATION_EVENT_DOMAIN
 
Constructor Summary
DefaultLocationManager(com.google.gwt.event.shared.HandlerManager eventBus, ApplicationView view, LocationStatusServiceAsync remoteService, de.novanic.eventservice.client.event.RemoteEventService remoteEventService, CommandExecutor commandExecutor)
          Constructor for DefaultLocationManager.
 
Method Summary
 void addLocationManagerInitializationCompleteEventHandler(LocationManagerInitializationCompleteEventHander handler)
          addLocationManagerInitializationCompleteEventHandler
 void applicationClicked()
          applicationClicked
protected  void displayDialog(String title, String contents)
          displayDialog
 void fitMapToLocations()
          fitMapToLocations
 Set<String> getAllApplicationNames()
          Fetch a list of all application names.
 Set<String> getAllLocationNames()
          getAllLocationNames
 ApplicationInfo getApplicationInfo(String name)
          
 LocationInfo getLocation(String locationName)
          
static String getLocationInfoDetails(LocationInfo locationInfo, LocationDetails locationDetails)
          getLocationInfoDetails
 ArrayList<LocationInfo> getLocationsForLocationPanel()
          TODO: Figure out if this public function is necessary or if we can get by just responding to incoming events.
protected  LocationStatusServiceAsync getRemoteService()
          getRemoteService
protected  void initializationComplete()
          initializationComplete
 void initialize(Set<Status> statuses)
          initialize
 void locationClicked()
          locationClicked
 void onApplicationDeselected(ApplicationDeselectedEvent event)
          onApplicationDeselected
 void onApplicationSelected(ApplicationSelectedEvent event)
          onApplicationSelected
 void onBoundsChanged(MapPanelBoundsChangedEvent e)
          onBoundsChanged
 void onFiltersChanged(FilterPanel.Filters filters)
          
 void onGWTMarkerClicked(GWTMarkerClickedEvent event)
          onGWTMarkerClicked
 void onGWTMarkerInfoWindowRefresh(GWTMarkerInfoWindowRefreshEvent event)
           
 void onLocationSelected(LocationPanelSelectEvent event)
          onLocationSelected
 void onStatusSelectionChanged(Status status, boolean selected)
          
 void onTagCleared()
          onTagCleared
 void onTagSelected(String tagName)
          
 void removeApplication(String applicationName)
          removeApplication
 void reportError(String errorMessage, Throwable throwable)
          
 void updateApplication(ApplicationInfo applicationInfo)
          updateApplication
 void updateComplete()
          Invoked by the UpdateCompleteRemoteEvent event.
 void updateLocation(LocationInfo newLocation)
          This action is used to respond to server-side events when a location is updated.
 void updateLocations(Collection<LocationInfo> locations)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultLocationManager

public DefaultLocationManager(com.google.gwt.event.shared.HandlerManager eventBus,
                              ApplicationView view,
                              LocationStatusServiceAsync remoteService,
                              de.novanic.eventservice.client.event.RemoteEventService remoteEventService,
                              CommandExecutor commandExecutor)

Constructor for DefaultLocationManager.

Parameters:
eventBus - a HandlerManager object.
view -
mapPanel - a MapPanel object.
panel - a SplitLayoutPanel object.
locationPanel - a LocationPanel object.
Method Detail

initialize

public void initialize(Set<Status> statuses)
Description copied from interface: LocationManager

initialize

Specified by:
initialize in interface LocationManager

initializationComplete

protected void initializationComplete()

initializationComplete


getRemoteService

protected LocationStatusServiceAsync getRemoteService()

getRemoteService

Returns:
a LocationStatusServiceAsync object.

addLocationManagerInitializationCompleteEventHandler

public void addLocationManagerInitializationCompleteEventHandler(LocationManagerInitializationCompleteEventHander handler)

addLocationManagerInitializationCompleteEventHandler

Specified by:
addLocationManagerInitializationCompleteEventHandler in interface LocationManager
Parameters:
handler - a LocationManagerInitializationCompleteEventHander object.

displayDialog

protected void displayDialog(String title,
                             String contents)

displayDialog

Parameters:
title - a String object.
contents - a String object.

getAllLocationNames

public Set<String> getAllLocationNames()

getAllLocationNames

Returns:
a Set object.

reportError

public void reportError(String errorMessage,
                        Throwable throwable)


fitMapToLocations

public void fitMapToLocations()

fitMapToLocations


getLocationsForLocationPanel

public ArrayList<LocationInfo> getLocationsForLocationPanel()
TODO: Figure out if this public function is necessary or if we can get by just responding to incoming events.

Returns:
a ArrayList object.

onLocationSelected

public void onLocationSelected(LocationPanelSelectEvent event)

onLocationSelected

Handler triggered when a user clicks on a specific location record.

Specified by:
onLocationSelected in interface LocationPanelSelectEventHandler
Parameters:
event - a LocationPanelSelectEvent object.

onBoundsChanged

public void onBoundsChanged(MapPanelBoundsChangedEvent e)

onBoundsChanged

Refresh the list of locations whenever the map panel boundaries change.

Specified by:
onBoundsChanged in interface MapPanelBoundsChangedEventHandler
Parameters:
e - a MapPanelBoundsChangedEvent object.

updateLocation

public void updateLocation(LocationInfo newLocation)
This action is used to respond to server-side events when a location is updated. Invoked by the LocationUpdatedRemoteEvent and LocationsUpdatedRemoteEvent events.

Specified by:
updateLocation in interface MapRemoteEventHandler
Parameters:
newLocation - a LocationInfo object.

updateApplication

public void updateApplication(ApplicationInfo applicationInfo)

updateApplication

Invoked by the ApplicationUpdatedRemoteEvent and ApplicationUpdatedRemoteEvent events.

Specified by:
updateApplication in interface MapRemoteEventHandler
Parameters:
applicationInfo - a ApplicationInfo object.

removeApplication

public void removeApplication(String applicationName)

removeApplication

Specified by:
removeApplication in interface MapRemoteEventHandler
Parameters:
applicationName - a String object.

updateComplete

public void updateComplete()
Invoked by the UpdateCompleteRemoteEvent event.

Specified by:
updateComplete in interface MapRemoteEventHandler

onFiltersChanged

public void onFiltersChanged(FilterPanel.Filters filters)

Specified by:
onFiltersChanged in interface FilterPanel.FiltersChangedEventHandler

onTagSelected

public void onTagSelected(String tagName)

Specified by:
onTagSelected in interface TagPanel.TagSelectedEventHandler

onTagCleared

public void onTagCleared()

onTagCleared

Specified by:
onTagCleared in interface TagPanel.TagClearedEventHandler

getAllApplicationNames

public Set<String> getAllApplicationNames()
Fetch a list of all application names.

Returns:
a Set object.

getApplicationInfo

public ApplicationInfo getApplicationInfo(String name)


getLocation

public LocationInfo getLocation(String locationName)


onGWTMarkerClicked

public void onGWTMarkerClicked(GWTMarkerClickedEvent event)

onGWTMarkerClicked

Specified by:
onGWTMarkerClicked in interface GWTMarkerClickedEventHandler
Parameters:
event - a GWTMarkerClickedEvent object.

onGWTMarkerInfoWindowRefresh

public void onGWTMarkerInfoWindowRefresh(GWTMarkerInfoWindowRefreshEvent event)
Specified by:
onGWTMarkerInfoWindowRefresh in interface GWTMarkerInfoWindowRefreshHandler

onStatusSelectionChanged

public void onStatusSelectionChanged(Status status,
                                     boolean selected)

Specified by:
onStatusSelectionChanged in interface FilterPanel.StatusSelectionChangedEventHandler

onApplicationSelected

public void onApplicationSelected(ApplicationSelectedEvent event)

onApplicationSelected

Specified by:
onApplicationSelected in interface ApplicationSelectedEventHandler
Parameters:
event - a ApplicationSelectedEvent object.

onApplicationDeselected

public void onApplicationDeselected(ApplicationDeselectedEvent event)

onApplicationDeselected

Specified by:
onApplicationDeselected in interface ApplicationDeselectedEventHandler
Parameters:
event - a ApplicationDeselectedEvent object.

locationClicked

public void locationClicked()

locationClicked

Specified by:
locationClicked in interface LocationManager

applicationClicked

public void applicationClicked()

applicationClicked

Specified by:
applicationClicked in interface LocationManager

getLocationInfoDetails

public static String getLocationInfoDetails(LocationInfo locationInfo,
                                            LocationDetails locationDetails)

getLocationInfoDetails

Parameters:
locationInfo - a LocationInfo object.
locationDetails - a LocationDetails object.
Returns:
a String object.

updateLocations

public void updateLocations(Collection<LocationInfo> locations)
Specified by:
updateLocations in interface MapRemoteEventHandler


Copyright © 2011. All Rights Reserved.