Package org.geomajas.gwt.client.command

Examples of org.geomajas.gwt.client.command.Deferred


      exportRequest.setQuoteChar(messages.exportToCsvQuoteChar());
      exportRequest.setLayerId(layer.getServerLayerId());

      GwtCommand command = new GwtCommand(ExportToCsvRequest.COMMAND);
      command.setCommandRequest(exportRequest);
      Deferred deferred = GwtCommandDispatcher.getInstance().execute(command, new CommandCallback() {
        private static final String CONTENT_PRE = "<div style='margin-top: 20px; width: 200px; text-align: "
            + "center'><b>";
        private static final String CONTENT_POST = "</b><br />";
        private static final String LINK_POST = "</div>";

        public void execute(CommandResponse response) {
          if (response instanceof ExportToCsvResponse) {
            ExportToCsvResponse resp = (ExportToCsvResponse) response;
            if (resp.getDocumentId() != null) {
              UrlBuilder ub = new UrlBuilder();
              ub.setPath("d/csvDownload");
              ub.setParameter("id", resp.getDocumentId());
              String link = ub.buildString().replaceFirst("http:///", GWT.getHostPageBaseURL());

              Window window = new DockableWindow();
              window.setTitle(messages.exportToCsvWindowTitle());
              String content = CONTENT_PRE + messages.exportToCsvContentReady() + CONTENT_POST;
              String linktocsv = messages.exportToCsvDownloadLink(link) + LINK_POST;
              window.addItem(new HTMLFlow(content + linktocsv));
              window.centerInPage();
              window.setAutoSize(true);
              window.show();
              window.setKeepInParentRect(true);
            }
            if (onFinished != null) {
              onFinished.execute();
            }
          }
        }
      });
      deferred.addErrorCallback(new Function() {
        public void execute() {
          if (onFinished != null) {
            onFinished.execute();
          }
        }
View Full Code Here


    request.setLayerFilters(getLayerFiltersForCriterion(criterion, mapWidget.getMapModel()));
    request.setFeatureIncludes(GwtCommandDispatcher.getInstance().getLazyFeatureIncludesSelect());

    GwtCommand commandRequest = new GwtCommand(FeatureSearchRequest.COMMAND);
    commandRequest.setCommandRequest(request);
    Deferred def = GwtCommandDispatcher.getInstance().execute(commandRequest, new CommandCallback() {
      public void execute(CommandResponse commandResponse) {
        if (commandResponse instanceof FeatureSearchResponse) {
          FeatureSearchResponse response = (FeatureSearchResponse) commandResponse;
          onFinished.execute(convertFromDto(response.getFeatureMap(),
              mapWidget.getMapModel()));
        }
      }
    });
    if (onError != null) {
      def.addErrorCallback(onError);
    }
  }
View Full Code Here

TOP

Related Classes of org.geomajas.gwt.client.command.Deferred

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.