polylineHash.put(p.getRoadDetailsId(), p);
polyline.setText(p.getRoadDetailsId());
String n = "";
for (Iterator iterator = roadDetailsList.iterator(); iterator
.hasNext();) {
RoadDetails roadDetails = (RoadDetails) iterator.next();
if(roadDetails.getId().equals(currentPolyline.getRoadDetailsId()))
{
n = roadDetails.getName();
}
}
vertices.setText("Current polyline in RoadListing=" + n);
String roadName = Window.prompt("Name this road", "");
if( roadName == null)
{
eventBus.fireEvent(new CancelRoadEvent(p.getRoadDetailsId()));
//refreshRoadDetails = true;
//fetchRoadDetails();
} else {
name.setText(roadName);
description.setText("");
}
}
});
eventBus.addHandler(GetRoadsEvent.TYPE,
new GetRoadsEventHandler() {
public void onGetRoads(GetRoadsEvent event) {
clearRoadEditView();
// TODO: remove force reload after testing is complete
refreshRoadDetails = true;
fetchRoadDetails();
}
});
eventBus.addHandler(SentUpdatedPolylineEvent.TYPE,
new SentUpdatedPolylineEventHandler() {
public void onSentUpdatedPolyline(SentUpdatedPolylineEvent event) {
currentPolyline = event.tagPolyline;
//Window.alert("SentUpdatedPolylineEvent id=" + currentPolyline.getRoadDetailsId());
//saveRoadDetails();
}
});
eventBus.addHandler(DebugEvent.TYPE,
new DebugEventHandler() {
public void onDebug(DebugEvent event) {
GWT.log("DEBUG ========================= BEGIN DEBUG EVENT IN ROADLISTING ===============");
GWT.log("DEBUG RoadListing: polylineHash keys=" + polylineHash.keySet());
GWT.log("DEBUG RoadListing: currentPolyline=" + currentPolyline);
}
});
eventBus.addHandler(EditRoadDetailsBySegmentEvent.TYPE,
new EditRoadDetailsBySegmentEventHandler() {
@Override
public void onEditRoadDetailsBySegment(EditRoadDetailsBySegmentEvent event) {
String id = event.getId();
//GWT.log("EDIT road details id=" + id);
if( id == null )
{
clearRoadEditView();
return;
}
// find the roadDetails with this id in
for (Iterator iterator = roadDetailsList.iterator(); iterator
.hasNext();) {
RoadDetails roadDetails = (RoadDetails) iterator.next();
//GWT.log("EDIT road details loop, working on id=" + roadDetails.getId());
if( roadDetails.getId().equals(id))
{
loadRoadDetails(roadDetails);
break;
}
}