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


Java WaveContext类代码示例

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


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

示例1: getDigest

import org.waveprotocol.wave.model.document.WaveContext; //导入依赖的package包/类
@Override
public DigestProxy getDigest(int index) {
  Preconditions.checkState(outstanding == null);
  DigestSnapshot result = results.get(index);
  WaveId waveId = result.getWaveId();
  String id = ModernIdSerialiser.INSTANCE.serialiseWaveId(waveId);
  DigestProxy proxy = digests.get(id);
  if (proxy == null) {
    proxy = new DigestProxy(result);
    digests.put(id, proxy);

    // Switch to a live digest if the wave is open.
    WaveContext wave = waveStore.getOpenWaves().get(waveId);
    if (wave != null) {
      proxy.activate(wave);
    }
  }

  return proxy;
}
 
开发者ID:apache,项目名称:incubator-wave,代码行数:21,代码来源:SimpleSearch.java

示例2: onStageThreeLoaded

import org.waveprotocol.wave.model.document.WaveContext; //导入依赖的package包/类
private void onStageThreeLoaded(StageThree x, Accessor<StageThree> whenReady) {
  if (closed) {
    // Stop the loading process.
    return;
  }
  three = x;
  if (isNewWave) {
    initNewWave(x);
  } else {
    handleExistingWave(x);
  }
  wave = new WaveContext(
      two.getWave(), two.getConversations(), two.getSupplement(), two.getReadMonitor());
  waveStore.add(wave);
  install();
  whenReady.use(x);
}
 
开发者ID:apache,项目名称:incubator-wave,代码行数:18,代码来源:StagesProvider.java

示例3: create

import org.waveprotocol.wave.model.document.WaveContext; //导入依赖的package包/类
public static Model create(WaveContext wave, String domain, ParticipantId loggedInUser,
                           boolean isNewWave, IdGenerator idGenerator) {

    WaveletId waveletId = WaveletId.of(domain, WAVELET_ID);
    ObservableWavelet wavelet = wave.getWave().getWavelet(waveletId);

    if (wavelet == null) {
        wavelet = wave.getWave().getWavelet(waveletId);
        wavelet.addParticipant(loggedInUser);
    }

    ObservableDocument modelDocument = wavelet.getDocument(ROOT_DOC_ID);
    DocEventRouter router = DefaultDocEventRouter.create(modelDocument);

    E metadataElement = DocHelper.getElementWithTagName(modelDocument, METADATA_TAG);
    if (metadataElement == null) {
        metadataElement = modelDocument.createChildElement(modelDocument.getDocumentElement(), METADATA_TAG,
                ImmutableMap.of(METADATA_ATTR_VERSION, MODEL_VERSION));
    }

    E strIndexElement = DocHelper.getElementWithTagName(modelDocument, STRING_INDEX_TAG);
    if (strIndexElement == null) {
        strIndexElement =
                modelDocument.createChildElement(modelDocument.getDocumentElement(), STRING_INDEX_TAG,
                        Collections.<String, String>emptyMap());
    }

    return new Model(wavelet, TypeIdGenerator.get(idGenerator), DocumentBasedElementList.create(
            router, strIndexElement, STRING_ITEM_TAG, StringIndexFactory), modelDocument);
}
 
开发者ID:apache,项目名称:incubator-wave-android,代码行数:31,代码来源:Model.java

示例4: activate

import org.waveprotocol.wave.model.document.WaveContext; //导入依赖的package包/类
/**
 * Switches to a live digest, sourced from a wave. This fires a change
 * event.
 */
void activate(WaveContext wave) {
  Preconditions.checkState(dynamicDigest == null);
  dynamicDigest = WaveBasedDigest.create(wave);
  dynamicDigest.addListener(this);
  fireOnChanged();
}
 
开发者ID:apache,项目名称:incubator-wave,代码行数:11,代码来源:SimpleSearch.java

示例5: onOpened

import org.waveprotocol.wave.model.document.WaveContext; //导入依赖的package包/类
/**
 * If the opened wave is in the search result, switches to an optimistic digest.
 */
@Override
public void onOpened(WaveContext wave) {
  String id = ModernIdSerialiser.INSTANCE.serialiseWaveId(wave.getWave().getWaveId());
  DigestProxy digest = digests.get(id);
  if (digest != null) {
    log.trace().log("switching to active digest for: ", id);
    digest.activate(wave);
  }
}
 
开发者ID:apache,项目名称:incubator-wave,代码行数:13,代码来源:SimpleSearch.java

示例6: onClosed

import org.waveprotocol.wave.model.document.WaveContext; //导入依赖的package包/类
@Override
public void onClosed(WaveContext wave) {
  String id = ModernIdSerialiser.INSTANCE.serialiseWaveId(wave.getWave().getWaveId());
  DigestProxy digest = digests.get(id);
  if (digest != null) {
    log.trace().log("switching to passive digest for: ", id);
    digest.deactivate();
  }
}
 
开发者ID:apache,项目名称:incubator-wave,代码行数:10,代码来源:SimpleSearch.java

示例7: onOpened

import org.waveprotocol.wave.model.document.WaveContext; //导入依赖的package包/类
@Override
public void onOpened(WaveContext wave) {
  String waveTitle = TitleHelper.getTitle(wave);
  String windowTitle = formatTitle(waveTitle);
  if (waveTitle == null || waveTitle.isEmpty()) {
    windowTitle = DEFAULT_TITLE;
  }
  Window.setTitle(windowTitle);
  waveFrame.setTitleText(waveTitle);
}
 
开发者ID:apache,项目名称:incubator-wave,代码行数:11,代码来源:WindowTitleHandler.java

示例8: add

import org.waveprotocol.wave.model.document.WaveContext; //导入依赖的package包/类
@Override
public void add(WaveContext wave) {
  WaveId id = wave.getWave().getWaveId();
  Preconditions.checkArgument(!waves.containsKey(id));
  waves.put(id, wave);
  fireOnWaveOpened(wave);
}
 
开发者ID:apache,项目名称:incubator-wave,代码行数:8,代码来源:SimpleWaveStore.java

示例9: remove

import org.waveprotocol.wave.model.document.WaveContext; //导入依赖的package包/类
@Override
public void remove(WaveContext wave) {
  WaveId id = wave.getWave().getWaveId();
  Preconditions.checkArgument(waves.get(id) == wave);
  waves.remove(id);
  fireOnWaveClosed(wave);
}
 
开发者ID:apache,项目名称:incubator-wave,代码行数:8,代码来源:SimpleWaveStore.java

示例10: getTitle

import org.waveprotocol.wave.model.document.WaveContext; //导入依赖的package包/类
/**
 * An error-absorbing title retrieving convenience function.
 * Please use this rather than doing:
 * wave.getConversations().getRoot().getRootThread().getFirstBlip().getContent()
 * as that is the cause of _many_ shiny's in the client.
 * In the event something went wrong, or no title exists will return the empty string.
 * This is deliberate, so that it doesn't propagate an error for a rather non-critical
 * code path.
 */
public static String getTitle(WaveContext waveCtx) {
  ObservableConversationView conversations = waveCtx.getConversations();
  if(conversations == null) {
    return "";
  }

  ObservableConversation rootConversation = conversations.getRoot();
  if(rootConversation == null) {
    return "";
  }

  ObservableConversationThread rootThread = rootConversation.getRootThread();
  if(rootThread == null) {
    return "";
  }

  ObservableConversationBlip firstBlip = rootThread.getFirstBlip();
  if(firstBlip == null) {
    return "";
  }

  Document doc = firstBlip.getContent();
  if(doc == null) {
    return "";
  }

  String title = extractTitle(doc);
  if(title == null) {
    return "";
  }

  return title;
}
 
开发者ID:apache,项目名称:incubator-wave,代码行数:43,代码来源:TitleHelper.java

示例11: createModel

import org.waveprotocol.wave.model.document.WaveContext; //导入依赖的package包/类
public String createModel() {

        WaveId newWaveId = waveTypeIdGenerator.newWaveId();
        final WaveRef waveRef = WaveRef.of(newWaveId);

        final WaveRender waveRender = new WaveRender(true, waveRef, waveChannel, waveParticipantId,
                Collections.<ParticipantId>emptySet(), waveIdGenerator, null, timer);

        waveRender.init(new Command() {

            @Override
            public void execute() {

                WaveContext wave = waveRender.getWaveContext();
                Model model = Model.create(wave, waveHost, waveParticipantId, true, waveIdGenerator);

                waveStore.put(waveRef, new Pair<WaveRender, Model>(waveRender, model));
            }
        });

        return waveRef.getWaveId().serialise();
    }
 
开发者ID:apache,项目名称:incubator-wave-android,代码行数:23,代码来源:WaveService.java

示例12: WaveBasedDigest

import org.waveprotocol.wave.model.document.WaveContext; //导入依赖的package包/类
WaveBasedDigest(WaveContext wave) {
  this.wave = wave;
}
 
开发者ID:apache,项目名称:incubator-wave,代码行数:4,代码来源:WaveBasedDigest.java

示例13: create

import org.waveprotocol.wave.model.document.WaveContext; //导入依赖的package包/类
/**
 * Creates a digest.
 */
public static WaveBasedDigest create(WaveContext wave) {
  WaveBasedDigest digest = new WaveBasedDigest(wave);
  digest.init();
  return digest;
}
 
开发者ID:apache,项目名称:incubator-wave,代码行数:9,代码来源:WaveBasedDigest.java

示例14: onClosed

import org.waveprotocol.wave.model.document.WaveContext; //导入依赖的package包/类
@Override
public void onClosed(WaveContext wave) {
  Window.setTitle(DEFAULT_TITLE);
}
 
开发者ID:apache,项目名称:incubator-wave,代码行数:5,代码来源:WindowTitleHandler.java

示例15: getOpenWaves

import org.waveprotocol.wave.model.document.WaveContext; //导入依赖的package包/类
@Override
public Map<WaveId, WaveContext> getOpenWaves() {
  return wavesView;
}
 
开发者ID:apache,项目名称:incubator-wave,代码行数:5,代码来源:SimpleWaveStore.java


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