• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java Receiver类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: refreshTaskList

import com.google.web.bindery.requestfactory.shared.Receiver; //导入依赖的package包/类
/**
 * Refresh the task list.
 */
private void refreshTaskList() {
  clientFactory.getRequestFactory().taskRequest().findAllTasks().fire(
      new Receiver<List<TaskProxy>>() {
        @Override
        public void onFailure(ServerFailure error) {
          // ignore
        }

        @Override
        public void onSuccess(List<TaskProxy> response) {
          // Early exit if this activity has already been canceled.
          if (eventBus == null) {
            return;
          }

          // Display the tasks in the view.
          if (response == null) {
            response = Collections.<TaskProxy> emptyList();
          }
          setTasks(response);

          // save the response to storage
          clientFactory.getTaskProxyLocalStorage().setTasks(response);

          // Restart the timer.
          refreshTimer.schedule(REFRESH_DELAY);
        }
      });
}
 
开发者ID:Peergos,项目名称:Peergos,代码行数:33,代码来源:TaskListPresenter.java


示例17: onPersonChanged

import com.google.web.bindery.requestfactory.shared.Receiver; //导入依赖的package包/类
void onPersonChanged(EntityProxyChange<PersonProxy> event) {
  if (WriteOperation.PERSIST.equals(event.getWriteOperation())) {
    // Re-fetch if we're already displaying the last page
    if (table.isRowCountExact()) {
      fetch(lastFetch + 1);
    }
  }
  if (WriteOperation.UPDATE.equals(event.getWriteOperation())) {
    EntityProxyId<PersonProxy> personId = event.getProxyId();

    // Is the changing record onscreen?
    int displayOffset = offsetOf(personId);
    if (displayOffset != -1) {
      // Record is onscreen and may differ from our data
      requestFactory.find(personId).fire(new Receiver<PersonProxy>() {
        @Override
        public void onSuccess(PersonProxy person) {
          // Re-check offset in case of changes while waiting for data
          int offset = offsetOf(person.stableId());
          if (offset != -1) {
            table.setRowData(table.getPageStart() + offset,
                Collections.singletonList(person));
          }
        }
      });
    }
  }
}
 
开发者ID:Peergos,项目名称:Peergos,代码行数:29,代码来源:SummaryWidget.java


示例18: onMarkFavorite

import com.google.web.bindery.requestfactory.shared.Receiver; //导入依赖的package包/类
private void onMarkFavorite(MarkFavoriteEvent event) {
  EntityProxyId<PersonProxy> id = event.getId();
  if (id == null) {
    return;
  }

  // EntityProxies should be compared by stable id
  PersonProxy found = null;
  for (PersonProxy displayed : displayedList) {
    if (displayed.stableId().equals(id)) {
      found = displayed;
      break;
    }
  }

  if (event.isFavorite() && found == null) {
    factory.find(id).to(new Receiver<PersonProxy>() {
      @Override
      public void onSuccess(PersonProxy response) {
        displayedList.add(response);
        sortDisplayedList();
      }
    }).fire();
  } else if (!event.isFavorite() && found != null) {
    displayedList.remove(found);
    sortDisplayedList();
  }
}
 
开发者ID:Peergos,项目名称:Peergos,代码行数:29,代码来源:FavoritesWidget.java


示例19: onChoose

import com.google.web.bindery.requestfactory.shared.Receiver; //导入依赖的package包/类
@UiHandler("choose")
void onChoose(ClickEvent event) {
  setEnabled(false);
  factory.schoolCalendarRequest().getRandomPerson().to(
      new Receiver<PersonProxy>() {
        @Override
        public void onSuccess(PersonProxy response) {
          setValue(response);
          setEnabled(true);
        }
      }).fire();
}
 
开发者ID:Peergos,项目名称:Peergos,代码行数:13,代码来源:MentorSelector.java


示例20: onSave

import com.google.web.bindery.requestfactory.shared.Receiver; //导入依赖的package包/类
/**
 * Called by the edit dialog's save button. This method will flush the
 * contents of the UI into the PersonProxy that is being edited, check for
 * 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;
  }

  // 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);
    }

    @Override
    public void onSuccess(Void response) {
      // If everything went as planned, just dismiss the dialog box
      dialog.hide();
    }
  });
}
 
开发者ID:Peergos,项目名称:Peergos,代码行数:33,代码来源:PersonEditorWorkflow.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java LineChartView类代码示例发布时间:2022-05-22
下一篇:
Java ContinuousDistribution类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap