本文整理汇总了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;
}
示例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);
}
示例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);
}
示例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();
}
示例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);
}
}
示例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();
}
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
示例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();
}
示例12: WaveBasedDigest
import org.waveprotocol.wave.model.document.WaveContext; //导入依赖的package包/类
WaveBasedDigest(WaveContext wave) {
this.wave = wave;
}
示例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;
}
示例14: onClosed
import org.waveprotocol.wave.model.document.WaveContext; //导入依赖的package包/类
@Override
public void onClosed(WaveContext wave) {
Window.setTitle(DEFAULT_TITLE);
}
示例15: getOpenWaves
import org.waveprotocol.wave.model.document.WaveContext; //导入依赖的package包/类
@Override
public Map<WaveId, WaveContext> getOpenWaves() {
return wavesView;
}