/** * Inserts an inline blip at the given position. * * @param position the index to insert the inline blip at. This has to be * greater than 0. * @return an instance of {@link Blip} that represents the new inline blip. */ public Blip insertInlineBlip(int position) { if (position <= 0 || position > content.length()) { throw new IllegalArgumentException("Illegal inline blip position: " + position + ". Position has to be greater than 0 and less than or equal to length."); } // Shift the elements. shift(position, 1); content = content.substring(0, position) + " " + content.substring(position); // Generate the operation. Blip inlineBlip = operationQueue.insertInlineBlipToDocument(this, position); // Insert the inline blip element. Element element = new Element(ElementType.INLINE_BLIP); element.setProperty(INLINE_BLIP_ELEMENT_ID_KEY, inlineBlip.getBlipId()); elements.put(position, element); return inlineBlip; }