private void remoteClearValue() { Doc.E toDelete = DocHelper.getLastElementWithTagName(doc, TAG, doc.getDocumentElement()); while (toDelete != null) { doc.deleteNode(toDelete); toDelete = DocHelper.getLastElementWithTagName(doc, TAG, doc.getDocumentElement()); } }
private void remoteClearValue() { Doc.E toDelete = DocHelper.getLastElementWithTagName(doc, TAG, doc.getDocumentElement()); while (toDelete != null) { doc.deleteNode(toDelete); toDelete = DocHelper.getLastElementWithTagName(doc, TAG, doc.getDocumentElement()); } }
/** * Inserts a last-child element. */ private void remoteInsertRedundantValue(String value) { doc.createChildElement(doc.getDocumentElement(), TAG, CollectionUtils.immutableMap(ATTR, value)); }
/** * Creates a singleton backed by a document root. */ private static DocumentBasedSingleton<Integer, String> createSingleton(DocEventRouter router) { return DocumentBasedSingleton.create(router, router.getDocument().getDocumentElement(), TAG, FACTORY); }
/** * Inserts a first-child element. */ private void remoteInsertCanonicalValue(String value) { Doc.N firstChild = doc.getFirstChild(doc.getDocumentElement()); Point<Doc.N> insertion = Point.<Doc.N>inElement(doc.getDocumentElement(), firstChild); doc.createElement(insertion, TAG, CollectionUtils.immutableMap(ATTR, value)); }
private void remoteRemoveRedundantValues() { Doc.E canonical = DocHelper.getElementWithTagName(doc, TAG); Doc.E toDelete = DocHelper.getLastElementWithTagName(doc, TAG, doc.getDocumentElement()); while (toDelete != canonical) { doc.deleteNode(toDelete); toDelete = DocHelper.getLastElementWithTagName(doc, TAG, doc.getDocumentElement()); } }
/** * Creates a singleton backed by a document root. */ private static DocumentBasedSingleton<Integer, String> createSingleton(DocEventRouter router) { return DocumentBasedSingleton.create(router, router.getDocument().getDocumentElement(), TAG, FACTORY); }
/** * Inserts a first-child element. */ private void remoteInsertCanonicalValue(String value) { Doc.N firstChild = doc.getFirstChild(doc.getDocumentElement()); Point<Doc.N> insertion = Point.<Doc.N>inElement(doc.getDocumentElement(), firstChild); doc.createElement(insertion, TAG, CollectionUtils.immutableMap(ATTR, value)); }
/** * Inserts a last-child element. */ private void remoteInsertRedundantValue(String value) { doc.createChildElement(doc.getDocumentElement(), TAG, CollectionUtils.immutableMap(ATTR, value)); }
private void remoteRemoveRedundantValues() { Doc.E canonical = DocHelper.getElementWithTagName(doc, TAG); Doc.E toDelete = DocHelper.getLastElementWithTagName(doc, TAG, doc.getDocumentElement()); while (toDelete != canonical) { doc.deleteNode(toDelete); toDelete = DocHelper.getLastElementWithTagName(doc, TAG, doc.getDocumentElement()); } }
/** * Creates a Permissions view on top of the document. */ public static DocumentBasedIndexability create(final DocEventRouter doc) { DocumentBasedBasicMap<Doc.E, ParticipantId, IndexDecision> map = DocumentBasedBasicMap.create(doc, doc.getDocument().getDocumentElement(), ParticipantIdSerializer.INSTANCE, new Serializer.EnumSerializer<IndexDecision>(IndexDecision.class), INDEX_TAG, ADDRESS_ATTR, VALUE_ATTR); DocumentBasedIndexability indexability = new DocumentBasedIndexability(map); map.addListener(indexability); return indexability; }
/** * Creates and stores a conversation container. If the container has a * conversation then initializes that too. */ private ConversationContainer createContainer(ObservableWavelet wavelet) { ObservableDocument manifestDoc = wavelet.getDocument(IdConstants.MANIFEST_DOCUMENT_ID); DocEventRouter router = DefaultDocEventRouter.create(manifestDoc); ObservableSingleton<DocumentBasedManifest, Void> manifestContainer = DocumentBasedSingleton.create(router, manifestDoc.getDocumentElement(), DocumentBasedManifest.MANIFEST_TOP_TAG, DocumentBasedManifest.FACTORY); ConversationContainer container = new ConversationContainer(wavelet, manifestContainer); manifestContainer.addListener(container); containers.put(wavelet, container); WaveletBasedConversation conversation = container.getConversation(); if (conversation != null) { conversations.put(wavelet, conversation); triggerOnConversationAdded(conversation); } return container; }
super.setUp(); this.realDoc = createDocument(); elmOne = realDoc.createChildElement(realDoc.getDocumentElement(), "a", noAttribs()); elmTwo = realDoc.createChildElement(realDoc.getDocumentElement(), "b", noAttribs()); this.doc = spy(realDoc); doAnswer(new Answer<Void>() {
super.setUp(); this.realDoc = createDocument(); elmOne = realDoc.createChildElement(realDoc.getDocumentElement(), "a", noAttribs()); elmTwo = realDoc.createChildElement(realDoc.getDocumentElement(), "b", noAttribs()); this.doc = spy(realDoc); doAnswer(new Answer<Void>() {