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


Java Wavelet类代码示例

本文整理汇总了Java中org.waveprotocol.wave.model.wave.Wavelet的典型用法代码示例。如果您正苦于以下问题:Java Wavelet类的具体用法?Java Wavelet怎么用?Java Wavelet使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: createDynamicRenderer

import org.waveprotocol.wave.model.wave.Wavelet; //导入依赖的package包/类
private DynamicDomRenderer createDynamicRenderer() {
  LiveSupplementRenderer supplementRenderer = LiveSupplementRenderer.create(getSupplementWave(),
      getModelAsViewProvider(), getThreadReadStateMonitor(), getNavigator());

  DynamicDomRenderer renderer = DynamicDomRenderer.create(getModelAsViewProvider(),
      getShallowBlipRenderer(), getFragmentRequester(), getBlipDocumentRenderer(),
      getNavigator(), getLiveProfileRenderer(), supplementRenderer, getElementRenderer(),
      getElementMeasurer());

  renderer.init(getQuasiConversationView());

  Wavelet wavelet = getWaveView().getRoot();
  WaveletId waveletId = wavelet != null ? wavelet.getId() : null;

  FocusFramePresenterImpl focus = getFocusFrame();
  focus.upgrade(getModelAsViewProvider(), getQuasiConversationView(), getNavigator(),
      getSupplementWave(), waveletId, getSupplementWave().getFocusedBlipId(waveletId), renderer);
  renderer.addListener(focus.getRendererListener());

  return renderer;
}
 
开发者ID:jorkey,项目名称:Wiab.pro,代码行数:22,代码来源:StageOneProvider.java

示例2: WaveletBasedSupplement

import org.waveprotocol.wave.model.wave.Wavelet; //导入依赖的package包/类
/**
 * Creates a supplement.
 *
 * @param userData wavelet to hold the supplement state
 */
private WaveletBasedSupplement(Wavelet userData) {
  folders = fungeCreateFolders(userData.getDocument(FOLDERS_DOCUMENT));
  muted = fungeCreateMuted(userData.getDocument(MUTED_DOCUMENT));
  waveletArchiveVersions = fungeCreateWaveletArchiveState(
      userData.getDocument(ARCHIVING_DOCUMENT));
  archiveCleared = fungeCreateCleared(userData.getDocument(CLEARED_DOCUMENT));
  ObservableDocument readState = userData.getDocument(READSTATE_DOCUMENT);
  read = fungeCreateReadState(readState, forwardingListener);
  ObservableDocument lookState = userData.getDocument(LOOKSTATE_DOCUMENT);    
  look = fungeCreateLookState(lookState, forwardingListener);
  collapsed = fungeCreateCollapsedState(
      userData.getDocument(PRESENTATION_DOCUMENT), forwardingListener);
  abuseStore = fungeCreateAbuseStore(userData.getDocument(ABUSE_DOCUMENT));
  seenVersion = fungeCreateSeenVersion(userData.getDocument(SEEN_DOCUMENT));
  notifiedVersion = fungeCreateNotifiedVersion(userData.getDocument(SEEN_DOCUMENT));
  pendingNotification = fungeCreatePendingNotification(userData.getDocument(SEEN_DOCUMENT));
  gadgetStates =
      fungeCreateGadgetStates(userData.getDocument(GADGETS_DOCUMENT), forwardingListener);
  blipStates = fungeCreateBlipStates(userData.getDocument(BLIPS_DOCUMENT), forwardingListener);

  hackCleanup(); // Cleanup before installing listeners, so we start from
                 // clean state.
  installListeners();
}
 
开发者ID:jorkey,项目名称:Wiab.pro,代码行数:30,代码来源:WaveletBasedSupplement.java

示例3: toBlipData

import org.waveprotocol.wave.model.wave.Wavelet; //导入依赖的package包/类
@Override
public BlipData toBlipData(ConversationBlip blip, Wavelet wavelet,
    EventMessageBundle eventMessageBundle) {
  ConversationBlip parentBlip = findBlipParent(blip);
  BlipData blipData = new BlipData();
  blipData.setCreator(blip.getAuthorId().getAddress());
  blipData.setContributors(idsToParticipantIdList(blip.getContributorIds()));
  blipData.setBlipId(blip.getId());
  blipData.setLastModifiedTime(blip.getLastModifiedTime());
  blipData.setVersion(blip.getLastModifiedVersion());
  blipData.setParentBlipId(parentBlip == null ? null : parentBlip.getId());
  blipData.setWaveId(ApiIdSerializer.instance().serialiseWaveId(wavelet.getWaveId()));
  blipData.setWaveletId(ApiIdSerializer.instance().serialiseWaveletId(wavelet.getId()));
  blipData.setChildBlipIds(toBlipIdList(findBlipChildren(blip)));

  ApiView apiView = new ApiView(blip.getDocument(), wavelet);
  // Set content.
  blipData.setContent(apiView.apiContents());
  // Set Annotations.
  blipData.setAnnotations(extractAnnotations(blip.getDocument(), apiView));
  // blip.getContent().rangedAnnotations(0, blip.getContent().size(), null),
  // Set Form Elements.
  blipData.setElements(ElementSerializer.serialize(blip.getDocument(), wavelet));
  return blipData;
}
 
开发者ID:jorkey,项目名称:Wiab.pro,代码行数:26,代码来源:EventDataConverterV21.java

示例4: getTitle

import org.waveprotocol.wave.model.wave.Wavelet; //导入依赖的package包/类
/**
 * Retrieves the title of a {@link Wavelet}.
 *
 * @param wavelet The {@link Wavelet} to retrieve the title from.
 * @param conversation The wavelet conversation
 * @return the title of the {@link Wavelet}, or an empty string if it has
 *     no title.
 */
private static String getTitle(Wavelet wavelet, Conversation conversation) {
  ConversationThread rootThread = conversation.getRootThread();
  if (rootThread == null) {
    return "";
  }
  ConversationBlip firstBlip = rootThread.getFirstBlip();
  if (firstBlip == null) {
    return "";
  }
  Document doc = firstBlip.getDocument();
  if (doc == null) {
    return "";
  }
  return TitleHelper.extractTitle(doc);
}
 
开发者ID:jorkey,项目名称:Wiab.pro,代码行数:24,代码来源:EventDataConverterV21.java

示例5: serialize

import org.waveprotocol.wave.model.wave.Wavelet; //导入依赖的package包/类
public static Map<Integer, Element> serialize(Document doc, Wavelet wavelet) {
  Map<Integer, Element> result = Maps.newHashMap();
  ApiView apiView = new ApiView(doc, wavelet);

  Doc.N node = Blips.getBody(doc);
  if (node != null) {
    // The node is the body; we're after its children
    node = doc.getFirstChild(node);
  }
  while (node != null) {
    E element = doc.asElement(node);
    if (element != null) {
      Element apiElement = xmlToApiElement(doc, element);
      if (apiElement != null) {
        result.put(apiView.transformToTextOffset(doc.getLocation(element)), apiElement);
      }
    }
    node = doc.getNextSibling(node);
  }
  return result;
}
 
开发者ID:jorkey,项目名称:Wiab.pro,代码行数:22,代码来源:ElementSerializer.java

示例6: setUp

import org.waveprotocol.wave.model.wave.Wavelet; //导入依赖的package包/类
@Override
protected void setUp() throws Exception {
  super.setUp();

  FakeWaveView view = BasicFactories.fakeWaveViewBuilder().with(idgen).build();
  Wavelet userDataWavelet = view.createUserData();
  ObservablePrimitiveSupplement primitiveSupplement =
      WaveletBasedSupplement.create(userDataWavelet);
  WaveBasedConversationView conversationView = WaveBasedConversationView.create(view, idgen);
  conversationView.createRoot();
  QuasiConversationViewImpl quasiConversationView = QuasiConversationViewImpl.create(null);
  supplementedWave = new LiveSupplementedWaveImpl(primitiveSupplement, view, viewer,
      DefaultFollow.ALWAYS, quasiConversationView);
  quasiConversationView.initialize(conversationView, supplementedWave);
  monitor = ThreadReadStateMonitorImpl.create(supplementedWave, quasiConversationView);
  rootThread = quasiConversationView.getRoot().getRootThread();
}
 
开发者ID:jorkey,项目名称:Wiab.pro,代码行数:18,代码来源:ThreadReadStateMonitorTest.java

示例7: testMarkingBlipAsReadAfterWaveUnreadMarksAtWaveletVersion

import org.waveprotocol.wave.model.wave.Wavelet; //导入依赖的package包/类
public void testMarkingBlipAsReadAfterWaveUnreadMarksAtWaveletVersion() {
  // Mark blip as read, then mark wavelet as unread, then mark blip as read
  // again, and test that it is marked at wavelet version. There is no real
  // design reason to test this use case; this is just here because it was a
  // specific case that was failing before.
  WaveletBasedConversation c = setUpWithWaveModel();
  Wavelet w = c.getWavelet();
  ObservableConversationThread t = c.getRootThread();
  ConversationBlip b = t.appendBlip();

  supplement.markAsRead(b);
  supplement.markAsUnread();

  // Do something to increase wavelet version without increasing blip last-modified version.
  t.appendBlip();

  // Mark as read again, test that it's marked at wavelet version.
  supplement.markAsRead(b);
  long blipReadVersion = substrate.getLastReadBlipVersion(w.getId(), b.getId());
  assertEquals(blipReadVersion, w.getVersion());
}
 
开发者ID:jorkey,项目名称:Wiab.pro,代码行数:22,代码来源:SupplementedWaveImplTest.java

示例8: testMarkingBlipAsReadAfterBlipModifiedMarksAtWaveletVersion

import org.waveprotocol.wave.model.wave.Wavelet; //导入依赖的package包/类
public void testMarkingBlipAsReadAfterBlipModifiedMarksAtWaveletVersion() {
  // Mark blip as read, then mark wavelet as unread, then mark blip as read
  // again, and test that it is marked at wavelet version. There is no real
  // design reason to test this use case; this is just here because it was a
  // specific case that was failing before.
  WaveletBasedConversation c = setUpWithWaveModel();
  Wavelet w = c.getWavelet();
  ObservableConversationThread t = c.getRootThread();
  ConversationBlip b = t.appendBlip();

  supplement.markAsRead(b);
  supplement.markAsUnread();

  // Increase both last-modified blip version and wavelet version (but latter more than former).
  b.getDocument().appendXml(Blips.INITIAL_CONTENT);
  t.appendBlip();

  // Mark as read again, test that it's marked at wavelet version, not blip last-modified version.
  supplement.markAsRead(b);
  long blipReadVersion = substrate.getLastReadBlipVersion(w.getId(), b.getId());
  assertEquals(blipReadVersion, w.getVersion());
}
 
开发者ID:jorkey,项目名称:Wiab.pro,代码行数:23,代码来源:SupplementedWaveImplTest.java

示例9: testReadStateAffectedByTagsState

import org.waveprotocol.wave.model.wave.Wavelet; //导入依赖的package包/类
public void testReadStateAffectedByTagsState() {
  WaveletBasedConversation c = setUpWithWaveModel();
  Wavelet w = c.getWavelet();
  WaveletId wId = w.getId();

  assertTrue(supplement.isTagsUnread(wId));

  addTags(w);
  assertTrue(supplement.isTagsUnread(wId));

  supplement.markAsRead();
  assertFalse(supplement.isTagsUnread(wId));

  supplement.markAsUnread();
  assertTrue(supplement.isTagsUnread(wId));

  supplement.markTagsAsRead(wId);
  assertFalse(supplement.isTagsUnread(wId));
}
 
开发者ID:jorkey,项目名称:Wiab.pro,代码行数:20,代码来源:SupplementedWaveImplTest.java

示例10: testLoadOnDomainlessWaveletIdsDoesNotFail

import org.waveprotocol.wave.model.wave.Wavelet; //导入依赖的package包/类
public void testLoadOnDomainlessWaveletIdsDoesNotFail() {
  DocInitialization readOp =
      BasicFactories.observableDocumentProvider().parse(
          "<wavelet i=\"conversation/root\"></wavelet>").toInitialization();
  DocInitialization archiveOp =
      BasicFactories.observableDocumentProvider().parse(
          "<archive i=\"conversation/root\"></archive>").toInitialization();
  DocInitialization seenOp =
      BasicFactories.observableDocumentProvider().parse(
          "<seen i=\"conversation/root\"></seen>").toInitialization();

  FakeWaveView view = BasicFactories.fakeWaveViewBuilder().build();
  Wavelet userData = view.createUserData();

  userData.getDocument(WaveletBasedSupplement.READSTATE_DOCUMENT).hackConsume(
      Nindo.fromDocOp(readOp, false));
  userData.getDocument(WaveletBasedSupplement.ARCHIVING_DOCUMENT).hackConsume(
      Nindo.fromDocOp(archiveOp, false));
  userData.getDocument(WaveletBasedSupplement.SEEN_DOCUMENT).hackConsume(
      Nindo.fromDocOp(seenOp, false));

  WaveletBasedSupplement.create(userData);
}
 
开发者ID:jorkey,项目名称:Wiab.pro,代码行数:24,代码来源:WaveletBasedSupplementTest.java

示例11: testCopySnapshotDoesNotCauseWrites

import org.waveprotocol.wave.model.wave.Wavelet; //导入依赖的package包/类
/**
 * Tests that the copy logic in
 * {@link PrimitiveSupplementImpl#PrimitiveSupplementImpl(PrimitiveSupplement)}
 * does not trigger any writes.
 *
 * This is a regression test for bug 2459305.
 */
public void testCopySnapshotDoesNotCauseWrites() {
  FakeConversationView view = FakeConversationView.builder().with(schemas).build();
  Wavelet udw = view.getWaveView().createUserData();
  PrimitiveSupplement substrate = WaveletBasedSupplement.create(udw);
  ParticipantId viewer = new ParticipantId("[email protected]");
  SupplementedWave swave = SupplementedWaveImpl.create(substrate, view, viewer, ALWAYS);

  // Do something that is readable
  view.createRoot().addParticipant(viewer);
  swave.markAsRead();

  // Save version to detect writes
  long udwVersion = udw.getVersion();

  // Copy into pojo
  new PrimitiveSupplementImpl(substrate);

  // Verify no writes.
  assertEquals(udwVersion, udw.getVersion());
}
 
开发者ID:jorkey,项目名称:Wiab.pro,代码行数:28,代码来源:WaveletBasedSupplementTest.java

示例12: testToBlipData

import org.waveprotocol.wave.model.wave.Wavelet; //导入依赖的package包/类
public void testToBlipData() throws Exception {
  Wavelet wavelet = mock(Wavelet.class);
  when(wavelet.getWaveId()).thenReturn(WAVE_ID);
  when(wavelet.getId()).thenReturn(WAVELET_ID);

  ConversationBlip blip = conversation.getRootThread().getFirstBlip();
  String replyThreadId = blip.addReplyThread(3).getId();

  EventDataConverterV22 converter = new EventDataConverterV22();
  EventMessageBundle eventMessageBundle = new EventMessageBundle(null, null);
  BlipData blipData = converter.toBlipData(blip, wavelet,
      eventMessageBundle);
  assertEquals(blip.getThread().getId(), blipData.getThreadId());
  assertEquals(Lists.newArrayList(replyThreadId), blipData.getReplyThreadIds());
  Map<String, BlipThread> threads = eventMessageBundle.getThreads();
  assertEquals(1, threads.size());
  assertEquals(1, threads.get(replyThreadId).getLocation());
}
 
开发者ID:jorkey,项目名称:Wiab.pro,代码行数:19,代码来源:EventDataConverterV22Test.java

示例13: testStringReplace

import org.waveprotocol.wave.model.wave.Wavelet; //导入依赖的package包/类
public void testStringReplace() {
  Document document =
      BasicFactories.documentProvider().parse(LineContainers.debugContainerWrap(""));
  ApiView api = new ApiView(document, mock(Wavelet.class));
  api.insert(1, "22 a b 22 c d 22 e f");
  while (true) {
    String contents = api.apiContents();
    int p = contents.indexOf("22");
    if (p < 0) {
      break;
    }
    api.insert(p, "q");
    assertInSync(document, api);
    api.delete(p + 1, p + 3);
    assertInSync(document, api);
  }
  assertEquals("\nq a b q c d q e f", api.apiContents());
  assertInSync(document, api);
}
 
开发者ID:jorkey,项目名称:Wiab.pro,代码行数:20,代码来源:ApiViewTest.java

示例14: testShift

import org.waveprotocol.wave.model.wave.Wavelet; //导入依赖的package包/类
public void testShift() {
  Document document =
      BasicFactories.documentProvider().parse(LineContainers.debugContainerWrap(""));
  ApiView api = new ApiView(document, mock(Wavelet.class));
  api.insert(1, "0123456789");
  api.insert(4, new Image("id1", "caption"));
  api.insert(8, new Image("id1", "caption"));
  assertInSync(document, api);
  api.delete(2, 3);
  List<ElementInfo> elements = api.getElements();
  assertEquals(3, elements.size());
  api.delete(elements.get(1).apiPosition, elements.get(0).apiPosition + 1);
  assertInSync(document, api);
  api.delete(api.getElements().get(1).apiPosition, elements.get(0).apiPosition + 1);
  assertInSync(document, api);
}
 
开发者ID:jorkey,项目名称:Wiab.pro,代码行数:17,代码来源:ApiViewTest.java

示例15: testComposeDocUsingAppend

import org.waveprotocol.wave.model.wave.Wavelet; //导入依赖的package包/类
public void testComposeDocUsingAppend() {
  Document document =
      BasicFactories.documentProvider().parse(LineContainers.debugContainerWrap(""));
  ApiView api = new ApiView(document, mock(Wavelet.class));
  api.insert(1, "hello");
  api.insert(1, new Image("id", "caption"));
  assertEquals(2, api.getElements().size());
  assertEquals("\n hello", api.apiContents());
  assertInSync(document, api);
  api.insert(api.apiContents().length(), " world");
  assertEquals("\n hello world", api.apiContents());
  assertInSync(document, api);
  api.insert(api.apiContents().length(), new Image("id", "caption"));
  assertInSync(document, api);
  api.insert(api.apiContents().length(), "!");
  assertEquals("\n hello world !", api.apiContents());
  assertInSync(document, api);
}
 
开发者ID:jorkey,项目名称:Wiab.pro,代码行数:19,代码来源:ApiViewTest.java


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