Exemple #1
0
  @Override
  public Undoer execute(final List<VertexRef> targets, final OperationContext operationContext) {
    final Collection<VertexRef> availableNodes = m_geoAssetProvider.getNodesWithCoordinates();

    final StringBuilder sb = new StringBuilder();
    sb.append(VaadinServlet.getCurrent().getServletContext().getContextPath());
    sb.append("/node-maps#search/nodeId%20in%20");

    final List<String> nodeIds = new ArrayList<String>();
    for (final VertexRef ref : targets) {
      if (availableNodes.contains(ref)) {
        nodeIds.add(ref.getId());
      }
    }

    final Iterator<String> i = nodeIds.iterator();
    while (i.hasNext()) {
      sb.append(i.next());
      if (i.hasNext()) {
        sb.append(",");
      }
    }

    final String redirectUrl = sb.toString();
    LOG.info("redirecting to: " + redirectUrl);
    final UI ui = operationContext.getMainWindow();
    ui.getPage().getJavaScript().execute("window.location = '" + redirectUrl + "';");

    return null;
  }
Exemple #2
0
  @Override
  public boolean enabled(final List<VertexRef> targets, final OperationContext operationContext) {
    final Collection<VertexRef> availableNodes = m_geoAssetProvider.getNodesWithCoordinates();

    for (final VertexRef ref : targets) {
      if (availableNodes.contains(ref)) {
        return true;
      }
    }

    return false;
  }