All Downloads are FREE. Search and download functionalities are using the official Maven repository.

fr.sii.ogham.html.inliner.EveryImageInliner Maven / Gradle / Ivy

package fr.sii.ogham.html.inliner;

import java.util.Arrays;
import java.util.List;

/**
 * Applies in sequence all provided decorated inliners. This may be useful to
 * allow several strategies to be applied on the same message content according
 * to the images.
 * 
 * @author Aurélien Baudet
 *
 */
public class EveryImageInliner implements ImageInliner {
	/**
	 * The list of inliners to apply in sequence
	 */
	private List inliners;

	public EveryImageInliner(ImageInliner... inliners) {
		this(Arrays.asList(inliners));
	}

	public EveryImageInliner(List inliners) {
		super();
		this.inliners = inliners;
	}

	@Override
	public ContentWithImages inline(String htmlContent, List images) {
		ContentWithImages combined = new ContentWithImages(htmlContent);
		for (ImageInliner inliner : inliners) {
			ContentWithImages partial = inliner.inline(combined.getContent(), images);
			combined.setContent(partial.getContent());
			combined.addAttachments(partial.getAttachments());
		}
		return combined;
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy