Package com.google.api.explorer.client.history

Examples of com.google.api.explorer.client.history.EmbeddedHistoryItemView


    detailPane.setVisible(context.isHistoryItemVisible() || context.isMethodFormVisible());
    detailPane.clear();

    if (context.isHistoryItemVisible()) {
      HistoryItem item = Iterables.getOnlyElement(context.getHistoryItems());
      EmbeddedHistoryItemView view = generateHistoryItemView(item);

      detailPane.add(view);
    } else if (context.isMethodFormVisible()) {
      ApiMethod method = context.getMethod();

      // Wrap the callback given by the context so that we may also be notified when a request is
      // finished. Pass through events to the original callback.
      CallbackWrapper cbWrapper = new CallbackWrapper();
      cbWrapper.delegate = context.getRequestFinishedCallback();
      cbWrapper.methodName = method.getId();

      // Create the view of the request editor and the single history item.
      EmbeddedView view = new EmbeddedView(authManager,
          context.getService(),
          method,
          context.getMethodParameters(),
          cbWrapper,
          HIDE_AUTH,
          analytics);

      cbWrapper.localView = view;

      // If this context came bundled with a history item, that means the navigation references a
      // previous executed request, and we should show the result.
      List<HistoryItem> historyItems = context.getHistoryItems();
      if (!historyItems.isEmpty()) {
        view.showHistoryItem(generateHistoryItemView(Iterables.getLast(historyItems)));
      }

      detailPane.add(view);
    }
View Full Code Here


  /**
   * Generate a view of the provided history item.
   */
  private EmbeddedHistoryItemView generateHistoryItemView(HistoryItem item) {
    EmbeddedHistoryItemView view = new EmbeddedHistoryItemView(item.getRequest());
    view.complete(item.getResponse(), item.getEndTime() - item.getStartTime(),
        JsonPrettifier.LOCAL_LINK_FACTORY);
    return view;
  }
View Full Code Here

    private Map<ApiRequest, EmbeddedHistoryItemView> incompleteRequests = Maps.newHashMap();

    @Override
    public void finished(ApiRequest request, ApiResponse response, long startTime, long endTime) {
      EmbeddedHistoryItemView toComplete = incompleteRequests.get(request);
      toComplete.complete(response, endTime - startTime, JsonPrettifier.LOCAL_LINK_FACTORY);
      incompleteRequests.remove(request);

      delegate.finished(request, response, startTime, endTime);
    }
View Full Code Here

      delegate.finished(request, response, startTime, endTime);
    }

    @Override
    public void starting(ApiRequest request) {
      EmbeddedHistoryItemView incomplete = new EmbeddedHistoryItemView(request);
      incompleteRequests.put(request, incomplete);
      localView.showHistoryItem(incomplete);

      delegate.starting(request);
    }
View Full Code Here

    }

    @Override
    public void finished(ApiRequest request, ApiResponse response, long startTime, long endTime) {
      super.finished(request, response, startTime, endTime);
      EmbeddedHistoryItemView historyItem = new EmbeddedHistoryItemView(request);
      historyItem.complete(response, endTime - startTime, JsonPrettifier.EXTERNAL_LINK_FACTORY);
      localView.showHistoryItem(historyItem);
    }
View Full Code Here

TOP

Related Classes of com.google.api.explorer.client.history.EmbeddedHistoryItemView

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.