当前位置: 首页>>代码示例>>Java>>正文


Java Receiver类代码示例

本文整理汇总了Java中com.google.web.bindery.requestfactory.shared.Receiver的典型用法代码示例。如果您正苦于以下问题:Java Receiver类的具体用法?Java Receiver怎么用?Java Receiver使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Receiver类属于com.google.web.bindery.requestfactory.shared包,在下文中一共展示了Receiver类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: fire

import com.google.web.bindery.requestfactory.shared.Receiver; //导入依赖的package包/类
/**
 * Make sure there's a default receiver so errors don't get dropped. This behavior should be
 * revisited when chaining is supported, depending on whether or not chained invocations can fail
 * independently.
 */
@Override
public void fire() {
  boolean needsReceiver = true;
  for (final AbstractRequest<?, ?> request : this.state.invocations) {
    if (request.hasReceiver()) {
      needsReceiver = false;
      break;
    }
  }

  if (needsReceiver) {
    this.doFire(new Receiver<Void>() {
      @Override
      public void onSuccess(final Void response) {
        // Don't care
      }
    });
  } else {
    this.doFire(null);
  }
}
 
开发者ID:ManfredTremmel,项目名称:gwt-bean-validators,代码行数:27,代码来源:AbstractRequestContext.java

示例2: save

import com.google.web.bindery.requestfactory.shared.Receiver; //导入依赖的package包/类
@Override
public void save() {
    CharacterRequest request = (CharacterRequest) driver.flush();
    request.persist(character).fire(new Receiver<Void>() {
        @Override
        public void onFailure(ServerFailure error) {
            view.showErrorMessage("An error occurred");
        }

        @Override
        public void onSuccess(Void response) {
            view.hideErrorMessage();
            refreshCharacter();
        }

        @Override
        public void onConstraintViolation(Set<ConstraintViolation<?>> violations) {
            StringBuilder builder = new StringBuilder();
            for (ConstraintViolation<?> violation : violations) {
                builder.append(violation.getMessage());
            }
            view.showErrorMessage(builder.toString());
        }
    });
}
 
开发者ID:dharmab,项目名称:sheets,代码行数:26,代码来源:CharacterActivity.java

示例3: onRangeChanged

import com.google.web.bindery.requestfactory.shared.Receiver; //导入依赖的package包/类
@Override
protected void onRangeChanged(HasData<DudeProxy> display) {
    final int length;
    if (cursor == 0) length = listRange;
    else length = incrementSize;

    DudeRequestFactory.DudeRequestContext context = createFactory().context();
    context.getSortedListByRange(cursor, cursor + length, sortColName, isAscending)
        .fire(new Receiver<List<DudeProxy>>() {
            @Override
            public void onSuccess(List<DudeProxy> dudeProxyList) {
                updateRowData(cursor, dudeProxyList);
                cursor = cursor + length;
            }
            @Override
            public void onFailure(ServerFailure error) {
                debugLabel.setText(error.getMessage());
            }
        });
}
 
开发者ID:arteezy,项目名称:infinite-scroll-gwt,代码行数:21,代码来源:DudeDataGrid.java

示例4: doDeleteTask

import com.google.web.bindery.requestfactory.shared.Receiver; //导入依赖的package包/类
/**
 * Delete the current task.
 */
private void doDeleteTask() {
  if (editTask == null) {
    return;
  }

  // Delete the task in the data store.
  final TaskProxy toDelete = this.editTask;
  clientFactory.getRequestFactory().taskRequest().remove().using(toDelete).fire(
      new Receiver<Void>() {
        @Override
        public void onFailure(ServerFailure error) {
          Window.alert("An error occurred on the server while deleting this task: \"."
              + error.getMessage() + "\".");
        }

        @Override
        public void onSuccess(Void response) {
          onTaskDeleted();
        }
      });
}
 
开发者ID:Peergos,项目名称:Peergos,代码行数:25,代码来源:TaskEditPresenter.java

示例5: toggleInUse

import com.google.web.bindery.requestfactory.shared.Receiver; //导入依赖的package包/类
public void toggleInUse(WeekDay day) {
  final TimeSlotKey key = new TimeSlotKey(day, hour);
  if (currentSchedule.contains(key)) {
    currentSchedule.remove(key);
    table.redraw();
  } else if (!existingSlots.containsKey(key)) {
    acceptClicks = false;
    ScheduleRequest context = factory.scheduleRequest();
    context.createTimeSlot(day.ordinal(), hour * 60, hour * 60 + 50).fire(
        new Receiver<TimeSlotProxy>() {
          @Override
          public void onSuccess(TimeSlotProxy slot) {
            existingSlots.put(key, slot);
            backing.add(slot);
            currentSchedule.add(key);
            table.redraw();
            acceptClicks = true;
          }
    });
  } else {
    currentSchedule.add(key);        
    table.redraw();
  }
}
 
开发者ID:Peergos,项目名称:Peergos,代码行数:25,代码来源:TimeSlotListWidget.java

示例6: fetch

import com.google.web.bindery.requestfactory.shared.Receiver; //导入依赖的package包/类
private void fetch(final int start) {
  lastFetch = start;
  requestFactory.schoolCalendarRequest().getPeople(start, numRows, filter).fire(
      new Receiver<List<PersonProxy>>() {
        @Override
        public void onSuccess(List<PersonProxy> response) {
          if (lastFetch != start) {
            return;
          }

          int responses = response.size();
          table.setRowData(start, response);
          pager.setPageStart(start);
          if (start == 0 || !table.isRowCountExact()) {
            table.setRowCount(start + responses, responses < numRows);
          }
        }
      });
}
 
开发者ID:Peergos,项目名称:Peergos,代码行数:20,代码来源:SummaryWidget.java

示例7: TransportEntry

import com.google.web.bindery.requestfactory.shared.Receiver; //导入依赖的package包/类
public TransportEntry(RequestContext requestContext, Receiver recv) {
    QosRequestTransport transport = (QosRequestTransport) requestContext.getRequestFactory().getRequestTransport();
    transport.startBatch();

    transport.setNextReceiverForEntry(QosRequestTransport.CAPTURE);

    if (recv == null) {
        requestContext.fire();
    } else {
        requestContext.fire(recv);
    }

    List<BatchedRequest> b = transport.flushBatch();
    payload = b.get(0).payload;
    receiver = b.get(0).receiver;

    // close the RequestContext so can be re-used.
    try {
        receiver.onTransportFailure(new ServerFailure("GOO"));
    } catch (Throwable th) {
    }
}
 
开发者ID:salk31,项目名称:gwt-rf-queue,代码行数:23,代码来源:TransportEntry.java

示例8: processPayload

import com.google.web.bindery.requestfactory.shared.Receiver; //导入依赖的package包/类
@Override
public void processPayload(final Receiver<Void> receiver, final String payload) {
  final Splittable raw = StringQuoter.split(payload);

  @SuppressWarnings("unchecked")
  final Receiver<Object> callback =
      (Receiver<Object>) AbstractRequestContext.this.state.invocations.get(0).getReceiver();

  if (!raw.isNull("error")) {
    final Splittable error = raw.get("error");
    final ServerFailure failure = new ServerFailure(error.get("message").asString(),
        error.get("code").asString(), payload, true);
    AbstractRequestContext.this.fail(receiver, failure);
    return;
  }

  final Splittable result = raw.get("result");
  @SuppressWarnings("unchecked")
  final Class<BaseProxy> target =
      (Class<BaseProxy>) AbstractRequestContext.this.state.invocations.get(0).getRequestData()
          .getReturnType();

  final SimpleProxyId<BaseProxy> id =
      AbstractRequestContext.this.getRequestFactory().allocateId(target);
  final AutoBean<BaseProxy> bean = AbstractRequestContext.this.createProxy(target, id, true);
  // XXX expose this as a proper API
  ((AbstractAutoBean<?>) bean).setData(result);
  // AutoBeanCodex.decodeInto(result, bean);

  if (callback != null) {
    callback.onSuccess(bean.as());
  }
  if (receiver != null) {
    receiver.onSuccess(null);
  }
}
 
开发者ID:ManfredTremmel,项目名称:gwt-bean-validators,代码行数:37,代码来源:AbstractRequestContext.java

示例9: refreshCharacter

import com.google.web.bindery.requestfactory.shared.Receiver; //导入依赖的package包/类
private void refreshCharacter() {
    requestFactory.getCharacterRequest().get(characterId).fire(new Receiver<CharacterProxy>() {
        @Override
        public void onSuccess(CharacterProxy response) {
            if (response == null) {
                goToCharacterNotFoundPlace();
            } else {
                editCharacter(response);
            }
        }
    });
}
 
开发者ID:dharmab,项目名称:sheets,代码行数:13,代码来源:CharacterActivity.java

示例10: refreshCharacterList

import com.google.web.bindery.requestfactory.shared.Receiver; //导入依赖的package包/类
private void refreshCharacterList() {
    requestFactory.getCharacterRequest().get(0, 1000).fire(new Receiver<List<CharacterProxy>>() {
        @Override
        public void onSuccess(List<CharacterProxy> response) {
            driver.edit(response, requestFactory.getCharacterRequest());
        }
    });
}
 
开发者ID:dharmab,项目名称:sheets,代码行数:9,代码来源:WelcomeActivity.java

示例11: createCharacter

import com.google.web.bindery.requestfactory.shared.Receiver; //导入依赖的package包/类
@Override
public void createCharacter() {
    CharacterRequest request = requestFactory.getCharacterRequest();
    CharacterProxy newCharacter = request.create(CharacterProxy.class);
    request.persist(newCharacter).fire(new Receiver<Void>() {
        @Override
        public void onSuccess(Void response) {
            refreshCharacterList();
        }
    });
}
 
开发者ID:dharmab,项目名称:sheets,代码行数:12,代码来源:WelcomeActivity.java

示例12: onCharacterDeletion

import com.google.web.bindery.requestfactory.shared.Receiver; //导入依赖的package包/类
@Override
public void onCharacterDeletion(CharacterDeletionEvent event) {
    requestFactory.getCharacterRequest().delete(event.getId()).fire(new Receiver<Void>() {
        @Override
        public void onSuccess(Void response) {
            refreshCharacterList();
        }
    });
}
 
开发者ID:dharmab,项目名称:sheets,代码行数:10,代码来源:WelcomeActivity.java

示例13: onRangeChanged

import com.google.web.bindery.requestfactory.shared.Receiver; //导入依赖的package包/类
@Override
protected void onRangeChanged(final HasData<EventProxy> display) {
	EventRequest request = factory.eventRequest();

	request.findAll().fire(new Receiver<List<EventProxy>>() {
		@Override
		public void onSuccess(List<EventProxy> response) {
			display.setRowData(0, response);
		}
	});
}
 
开发者ID:burakince,项目名称:open-course-organizer,代码行数:12,代码来源:EventsDataProvider.java

示例14: loadSubject

import com.google.web.bindery.requestfactory.shared.Receiver; //导入依赖的package包/类
@Override
public void loadSubject(Long subjectId) {
	SubjectRequest request = factory.subjectRequest();

	request.findById(subjectId).fire(new Receiver<SubjectProxy>() {
		@Override
		public void onSuccess(SubjectProxy response) {
			view.loadSubject(response);
		}
	});
}
 
开发者ID:burakince,项目名称:open-course-organizer,代码行数:12,代码来源:SubjectPresenter.java

示例15: saveTask

import com.google.web.bindery.requestfactory.shared.Receiver; //导入依赖的package包/类
public void saveTask() {
  // Flush the changes into the editable task.
  TaskRequest context = (TaskRequest) clientFactory.getTaskEditView().getEditorDriver().flush();

  /*
   * Create a persist request the first time we try to save this task. If a
   * request already exists, reuse it.
   */
  if (taskPersistRequest == null) {
    taskPersistRequest = context.persist().using(editTask);
  }

  // Fire the request.
  taskPersistRequest.fire(new Receiver<Void>() {
    @Override
    public void onConstraintViolation(Set<ConstraintViolation<?>> violations) {
      handleConstraintViolations(violations);
    }

    @Override
    public void onSuccess(Void response) {
      editTask = null;

      // Notify the user that the task was updated.
      TaskEditPresenter.this.notify("Task Saved");
      
      // Return to the task list.
      ActionEvent.fire(eventBus, ActionNames.TASK_SAVED);
    }
  });
}
 
开发者ID:Peergos,项目名称:Peergos,代码行数:32,代码来源:TaskEditPresenter.java


注:本文中的com.google.web.bindery.requestfactory.shared.Receiver类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。