Package com.google.web.bindery.requestfactory.shared

Examples of com.google.web.bindery.requestfactory.shared.RequestContext


     */
    protected void doLoadEntityProxy(final Receiver<P> onloadCallback) {
        final String proxyId = getEntityId();
        if(proxyId == null) {
            //create a brand new proxy entity
            final RequestContext requestContext = createProxyRequest();
            final P proxy = createProxy(requestContext);
            //edit this entity proxy on the same request it was created
            editorDriver.edit(proxy, saveOrUpdateRequest(requestContext, proxy));
            //finish loading
            onloadCallback.onSuccess(proxy);
View Full Code Here


     */
    protected void loadItems(final S searchCriteria, final Range range) {
        if(searchCriteria instanceof BaseProxy) {
            proxyFactory.setFrozen((BaseProxy) searchCriteria, true);
        }
        final RequestContext requestContext = createRequestContext();
        createCountRequest(requestContext, searchCriteria).fire(new Receiver<Long>() {
            @Override
            public void onSuccess(final Long response) {
                if (view == null) {
                    // This activity is dead
View Full Code Here

    /**
     * Called by the table as it needs data.
     */
    protected void onRangeChanged(final HasData<P> hasData, final Range range, final ColumnSortList columnSortList) {
        final RequestContext requestContext = createRequestContext();
        createSearchRequest(requestContext, searchCriteria, range, columnSortList)
        .with(view.getPaths()).fire( new Receiver<List<P>>() {
            @Override
            public void onSuccess(final List<P> results) {
                if (view == null) {
View Full Code Here

   * errors, and send the request to the server.
   */
  @UiHandler("save")
  void onSave(ClickEvent event) {
    // Flush the contents of the UI
    RequestContext context = editorDriver.flush();

    // Check for errors
    if (editorDriver.hasErrors()) {
      dialog.setText("Errors detected locally");
      return;
    }

    // context.update(author);

    // Send the request
    context.fire(new Receiver<Void>() {
      @Override
      public void onConstraintViolation(Set<ConstraintViolation<?>> errors) {
        // Otherwise, show ConstraintViolations in the UI
        dialog.setText("Errors detected on the server");
        editorDriver.setConstraintViolations(errors);
View Full Code Here

      }
    });
  }

  public void testMultipleEdits() {
    RequestContext c1 = req.simpleFooRequest();
    SimpleFooProxy proxy = c1.create(SimpleFooProxy.class);
    // Re-editing is idempotent
    assertSame(proxy, c1.edit(c1.edit(proxy)));

    // Should not allow "crossing the steams"
    RequestContext c2 = req.simpleFooRequest();
    try {
      c2.edit(proxy);
      fail();
    } catch (IllegalArgumentException expected) {
    }
  }
View Full Code Here

  /**
   * Tests a message consisting only of operations, with no invocations.
   */
  public void testOperationOnlyMessage() {
    delayTestFinish(DELAY_TEST_FINISH);
    RequestContext ctx = simpleFooRequest();
    SimpleFooProxy proxy = ctx.create(SimpleFooProxy.class);
    proxy.setUserName("GWT");
    ctx.fire(new Receiver<Void>() {
      @Override
      public void onSuccess(Void response) {
        finishTestAndReset();
      }
    });
View Full Code Here

    Factory f = createChainedFactory();

    ACtx aCtx = f.a();
    checkReachableTypes(aCtx, AProxy.class, BProxy.class);

    RequestContext ctx = aCtx.a().to(new Receiver<AProxy>() {
      @Override
      public void onSuccess(AProxy response) {
        assertNotNull(response);
      }
    });

    BCtx bCtx = ctx.append(f.b());
    checkReachableTypes(aCtx, AProxy.class, BProxy.class);
    checkReachableTypes(bCtx, BProxy.class, AProxy.class);

    bCtx.b().to(new Receiver<BProxy>() {
      @Override
      public void onSuccess(BProxy response) {
        assertNotNull(response);
      }
    });
    ctx.fire(new Receiver<Void>() {
      @Override
      public void onSuccess(Void response) {
        finishTest();
      }
    });
View Full Code Here

    if (bean == null) {
      // Unexpected; some kind of foreign implementation?
      throw new IllegalArgumentException(object.getClass().getName());
    }

    RequestContext context = bean.getTag(REQUEST_CONTEXT);
    if (!bean.isFrozen() && context != this) {
      /*
       * This means something is way off in the weeds. If a bean is editable,
       * it's supposed to be associated with a RequestContext.
       */
 
View Full Code Here

TOP

Related Classes of com.google.web.bindery.requestfactory.shared.RequestContext

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.