private PageContext extract(Route route, JsonNode item) { Map<String, Object> variables = new HashMap<>(); route .getExtract() .entrySet() .stream() .forEach( entry -> { variables.put(entry.getKey(), apply(item, entry.getValue())); }); Page target = application.route(route.getPath()); return new PageContext(target, variables); }
@Override public void apply(TableRow<JsonNode> row, Relation relation) { row.setOnMouseClicked( event -> { Route route = back.peek().getRoute(relation); if (route == null) { return; } if (!row.isEmpty() && event.getButton() == MouseButton.PRIMARY && event.getClickCount() == 2) { JsonNode item = row.getItem(); if (item == null) { return; } try { push(extract(route, item)); } catch (QueryException e) { log.error("Unable to push page: %s", route.getPath(), e); } } }); }