LatLon from = mapViewLocal.getLatLon(mouseEvent.getX(),
mouseEvent.getY());
GeometryFactory gf = new GeometryFactory();
f.setGeometria(gf.createPoint(new Coordinate(
from.lon(), from.lat())));
IncidenceDialog id = new IncidenceDialog(
f,
i18n.getString("Incidences.summary.title")
+ " "
+ i18n.getString("Incidences.nuevaIncidencia"),
"tittleficha_icon_recurso");
id.setVisible(true);
} else if (e.getActionCommand().equals(// ruta desde
i18n.getString("map.menu.route.from"))) {
routeDialog.showRouteDialog(mapViewLocal.getLatLon(
mouseEvent.getX(), mouseEvent.getY()), null,
mapViewLocal);
} else if (e.getActionCommand().equals(// ruta hasta
i18n.getString("map.menu.route.to"))) {
routeDialog.showRouteDialog(null,
mapViewLocal.getLatLon(mouseEvent.getX(),
mouseEvent.getY()), mapViewLocal);
} else if (e.getActionCommand().equals(// Actualizar gps
i18n.getString("map.menu.gps"))) {
if (!(menuObjective instanceof Recurso)) {
return null;
}
GPSDialog sdsDialog = null;
for (Frame f : Frame.getFrames()) {
if (f instanceof GPSDialog)
if (((GPSDialog) f).getRecurso().equals(
menuObjective))
sdsDialog = (GPSDialog) f;
}
if (sdsDialog == null)
sdsDialog = new GPSDialog((Recurso) menuObjective);
sdsDialog.setVisible(true);
sdsDialog.setExtendedState(JFrame.NORMAL);
} else if (e.getActionCommand().equals(// Ficha
i18n.getString("map.menu.summary"))) {
if (log.isTraceEnabled()) {
log.trace("Mostramos la ficha del objetivo del menu");
}
if (menuObjective instanceof Recurso) {
log.trace(">recurso");
SwingWorker<Object, Object> sw = new SwingWorker<Object, Object>() {
@Override
protected Object doInBackground()
throws Exception {
for (Frame f : JFrame.getFrames()) {
if (f.getName().equals(
((Recurso) menuObjective)
.getIdentificador())
&& f instanceof SummaryDialog) {
if (f.isShowing()) {
f.toFront();
f.setExtendedState(JFrame.NORMAL);
return null;
}
}
}
new SummaryDialog((Recurso) menuObjective)
.setVisible(true);
return null;
}
};
sw.execute();
} else if (menuObjective instanceof Incidencia) {
if (log.isTraceEnabled()) {
log.trace(">incidencia");
}
SwingWorker<Object, Object> sw = new SwingWorker<Object, Object>() {
@Override
protected Object doInBackground()
throws Exception {
for (Frame f : JFrame.getFrames()) {
if (f.getName().equals(
((Incidencia) menuObjective)
.getTitulo())
&& f instanceof IncidenceDialog) {
if (log.isTraceEnabled()) {
log.trace("Ya lo tenemos abierto");
}
if (f.isShowing()) {
f.toFront();
f.setExtendedState(JFrame.NORMAL);
} else {
f.setVisible(true);
f.setExtendedState(JFrame.NORMAL);
}
return null;
}
}
if (log.isTraceEnabled()) {
log.trace("Abrimos uno nuevo");
}
new IncidenceDialog(
(Incidencia) menuObjective,
i18n.getString("Incidences.summary.title")
+ " "
+ ((Incidencia) menuObjective)
.getTitulo(),