/** * Creates an entry element for the specified map entry. * * @param value */ private void createEntry(C value) { Map<String, String> attrs = new HashMap<String, String>(); attrs.put(valueAttrName, serializer.toString(value)); E entry = getDocument().createChildElement(container, entryTagName, attrs); }
@Override public T add(I initialState) { Map<String, String> attributes = Initializer.Helper.buildAttributes(initialState, factory); E element = getDocument().createChildElement(parent, childTag, attributes); // As we are using an observable document, that is registered to post us events, we expect // that onElementAdded is called once the child is created. This method in turn creates a // child object for the given element and store it in the elementToValue map. We use this to // return the child for the given element. return elementToValue.get(element); }
@Override public void add(T value) { Preconditions.checkNotNull(value, "value must not be null"); // Add an element to represent the value if (!valueElements.containsKey(value)) { Attributes attrs = new AttributesImpl(valueAttrName, serializer.toString(value)); getDocument().createChildElement(container, entryTagName, attrs); deleteObsoleteElements(); } }
private void createEntry(WaveletId waveletId) { String waveletIdStr = WaveletBasedConversation.idFor(waveletId); ObservableMutableDocument<? super E, E, ?> doc = getDocument(); E container = doc.createChildElement(doc.getDocumentElement(), WaveletBasedSupplement.CONVERSATION_TAG, new AttributesImpl(WaveletBasedSupplement.ID_ATTR, waveletIdStr)); }
void addEntry(C value) { Map<String, String> attrs = new HashMap<String, String>(); attrs.put(VALUE_ATTR, serializer.toString(value)); E child = context.doc.createChildElement(context.container, ENTRY_TAG, new AttributesImpl(attrs)); }
void addEntry(C value) { Map<String, String> attrs = new HashMap<String, String>(); attrs.put(VALUE_ATTR, serializer.toString(value)); E child = context.doc.createChildElement(context.container, ENTRY_TAG, new AttributesImpl(attrs)); }
private void createEntry(String gadgetId) { getDocument().createChildElement(getDocument().getDocumentElement(), WaveletBasedSupplement.GADGET_TAG, new AttributesImpl(WaveletBasedSupplement.ID_ATTR, gadgetId)); }
@Override public <N, E extends N, T extends N> void exec(ObservableMutableDocument<N, E, T> doc) { E container = doc.getDocumentElement(); // Insert entries Attributes attrs = state != null ? new AttributesImpl(VALUE_ATTR, state.toString()) : Attributes.EMPTY_MAP; doc.createChildElement(container, ENTRY_TAG, attrs); } });
@Override public <N, E extends N, T extends N> void exec(ObservableMutableDocument<N, E, T> doc) { E container = doc.getDocumentElement(); // Insert entries Attributes attrs = state != null ? new AttributesImpl(VALUE_ATTR, state.toString()) : Attributes.EMPTY_MAP; doc.createChildElement(container, ENTRY_TAG, attrs); } });
private void createEntry(WaveletId waveletId) { String waveletIdStr = WaveletBasedConversation.idFor(waveletId); E container = getDocument().createChildElement(getDocument().getDocumentElement(), WaveletBasedSupplement.WAVELET_TAG, new AttributesImpl(WaveletBasedSupplement.ID_ATTR, waveletIdStr)); }
/** * Populates a document with an initial map state defined by an entry list. * * @return a map-context view of the document state. */ private static <N, E extends N, T extends N> ValueContext<N, E> substrate( ObservableMutableDocument<N, E, T> doc, int ... values) { // Insert container element E container = doc.createChildElement(doc.getDocumentElement(), CONTAINER_TAG, Collections.<String,String>emptyMap()); for (int value : values) { Attributes attrs = new AttributesImpl(VALUE_ATTR, Serializer.INTEGER.toString(value)); doc.createChildElement(container, ENTRY_TAG, attrs); } return new ValueContext<N, E>(doc, container); }
/** * Populates a document with an initial map state defined by an entry list. * * @return a map-context view of the document state. */ private static <N, E extends N, T extends N> ValueContext<N, E> substrate( ObservableMutableDocument<N, E, T> doc, int ... values) { // Insert container element E container = doc.createChildElement(doc.getDocumentElement(), CONTAINER_TAG, Collections.<String,String>emptyMap()); for (int value : values) { Attributes attrs = new AttributesImpl(VALUE_ATTR, Serializer.INTEGER.toString(value)); doc.createChildElement(container, ENTRY_TAG, attrs); } return new ValueContext<N, E>(doc, container); }
private <E> ObservableManifestThread buildThreadElement2( ObservableMutableDocument<? super E, E, ?> document, String id) { E root = DocHelper.getOrCreateFirstTopLevelElement(document, "conversation"); E blip = document.createChildElement(root, "blip", CollectionUtils.immutableMap("id", "b+top")); E container = document.createChildElement(blip, "thread", CollectionUtils.immutableMap("id", id)); return DocumentBasedManifestThread.create(DefaultDocumentEventRouter.create(document), container); } }
private <E> ObservableManifestThread buildThreadElement2( ObservableMutableDocument<? super E, E, ?> document, String id) { E root = DocHelper.getOrCreateFirstTopLevelElement(document, "conversation"); E blip = document.createChildElement(root, "blip", CollectionUtils.immutableMap("id", "b+top")); E container = document.createChildElement(blip, "thread", CollectionUtils.immutableMap("id", id)); return DocumentBasedManifestThread.create(DefaultDocumentEventRouter.create(document), container); } }
void addEntry(K key, C value) { String keyString = keySerializer.toString(key); String valueString = valueSerializer.toString(value); Attributes attrs = new AttributesImpl(KEY_ATTR, keyString, VALUE_ATTR, valueString); E child = context.doc.createChildElement(context.container, ENTRY_TAG, attrs); }
void addEntry(K key, C value) { String keyString = keySerializer.toString(key); String valueString = valueSerializer.toString(value); Attributes attrs = new AttributesImpl(KEY_ATTR, keyString, VALUE_ATTR, valueString); E child = context.doc.createChildElement(context.container, ENTRY_TAG, attrs); }
/** * Populates a document with an initial map state defined by an entry list. * * @return a map-context view of the document state. */ private static <N, E extends N> ValueContext<N, E> substrate( ObservableMutableDocument<N, E, ?> doc, int value) { // Insert container element E container = doc.createChildElement(doc.getDocumentElement(), CONTAINER_TAG, Collections.<String,String>emptyMap()); doc.setElementAttribute(container, VALUE_ATTR, Serializer.INTEGER.toString(value)); return new ValueContext<N, E>(doc, container); }
/** * Populates a document with an initial map state defined by an entry list. * * @return a map-context view of the document state. */ private static <N, E extends N> ValueContext<N, E> substrate( ObservableMutableDocument<N, E, ?> doc, int value) { // Insert container element E container = doc.createChildElement(doc.getDocumentElement(), CONTAINER_TAG, Collections.<String,String>emptyMap()); doc.setElementAttribute(container, VALUE_ATTR, Serializer.INTEGER.toString(value)); return new ValueContext<N, E>(doc, container); }
private <E> ObservableManifestBlip buildBlipElement2( ObservableMutableDocument<? super E, E, ?> document, String id) { E root = DocHelper.getOrCreateFirstTopLevelElement(document, "conversation"); E container = document.createChildElement(root, "blip", CollectionUtils.immutableMap("id", id)); return DocumentBasedManifestBlip.create(DefaultDocumentEventRouter.create(document), container); } }
private <E> ObservableManifestBlip buildBlipElement2( ObservableMutableDocument<? super E, E, ?> document, String id) { E root = DocHelper.getOrCreateFirstTopLevelElement(document, "conversation"); E container = document.createChildElement(root, "blip", CollectionUtils.immutableMap("id", id)); return DocumentBasedManifestBlip.create(DefaultDocumentEventRouter.create(document), container); } }